<?php include in concatenation

Auryg

Platinum Member
Dec 28, 2003
2,377
0
71
Here's a snippet of the code:

if ($catnumber < 9)
$content = $content."<td width=\"100%\"> <?php include 'roundedStart.php'?>
<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"4\" bgcolor=\"#FFFFFF\">..........................

The "<?php include" part doesn't seem to work. I don't know much about web stuff though, so I have no idea what to google for in this instance =/ Of course, I could just be doing something else wrong too. Any help would be greatly appreciated.
 

Drakkon

Diamond Member
Aug 14, 2001
8,401
1
0
do you know what the error/warning it is returning is?
only thing i see would be the need of a semicolon...
 

Auryg

Platinum Member
Dec 28, 2003
2,377
0
71
I'm not getting any error/warning. It's just not showing up. Where would the semicolon go?
 

presidentender

Golden Member
Jan 23, 2008
1,166
0
76
You never leave php, so you don't need to enter it again. I'd do something like

if($catnumber < 9)
{
include 'roundedStart.php';
$content = $content."<td width=\"100%\"><table width=\"100%\" border=\"0\" cellpadding=\"3\" ...
}

which I think is much more readable.

What's in roundedStart.php?
 

Auryg

Platinum Member
Dec 28, 2003
2,377
0
71
Originally posted by: presidentender
You never leave php, so you don't need to enter it again. I'd do something like

if($catnumber < 9)
{
include 'roundedStart.php';
$content = $content."<td width=\"100%\"><table width=\"100%\" border=\"0\" cellpadding=\"3\" ...
}

which I think is much more readable.

What's in roundedStart.php?

It's some code to make rounded corners, and it needs to come after the <td>...I see how what I did was a problem, but I'm still not sure how to fix it as it now just prints out "include 'roundedStart.php'" where the code should be doing it's thing.

So what do I do about that? Thanks.
 

GeekDrew

Diamond Member
Jun 7, 2000
9,099
19
81
What's the contents of roundedStart.php? (Abbreviated, if necessary?)
 

Auryg

Platinum Member
Dec 28, 2003
2,377
0
71
Originally posted by: GeekDrew
What's the contents of roundedStart.php? (Abbreviated, if necessary?)

<div>
<b class="spiffy">
<b class="spiffy1"><b></b></b>
<b class="spiffy2"><b></b></b>
<b class="spiffy3"></b>
<b class="spiffy4"></b>
<b class="spiffy5"></b></b>

<div class="spiffyfg">
<!-- content goes here -->
</div>

<b class="spiffy">
<b class="spiffy5"></b>
<b class="spiffy4"></b>
<b class="spiffy3"></b>
<b class="spiffy2"><b></b></b>
<b class="spiffy1"><b></b></b></b>
</div>

It's the 'spiffy corners' code. I've split it in to two files (right where the 'content goes here' comment is) and I have it working just fine on other parts of the same page. It's kind of a hack job but at this point I just want it to work :)

 

DaveSimmons

Elite Member
Aug 12, 2001
40,730
670
126
why not assign the file to a string, and use that?

... $spiffycorner = read file ...

$content .= "<td width=\"100%\">" . $spiffycorner . "..."
 

presidentender

Golden Member
Jan 23, 2008
1,166
0
76
Originally posted by: DaveSimmons
why not assign the file to a string, and use that?

... $spiffycorner = read file ...

$content .= "<td width=\"100%\">" . $spiffycorner . "..."

Yeah, I'm pretty sure strings don't like 'include' statements inside them.
 

Auryg

Platinum Member
Dec 28, 2003
2,377
0
71
Alright guys, thanks for all the help. I learned a lot but I actually never really solved the problem...but I can deal with ugly code in a few places. I think part of the problem was the html in the file I was trying to include had a lot of quotation marks, for one. Of course, when I changed that it broke a bunch of other things I had already done...won't make that mistake in the future. Thanks again.
 

sourceninja

Diamond Member
Mar 8, 2005
8,805
65
91
if($catnumber < 9)
{
echo .'<td width="100%"><table width="100%" border="0" cellpadding="3" ...';
include 'roundedStart.php';
echo more crap
}
then inside roundedStart.php
<?php
echo <<<END
<div>
<b class="spiffy">
<b class="spiffy1"><b></b></b>
<b class="spiffy2"><b></b></b>
<b class="spiffy3"></b>
<b class="spiffy4"></b>
<b class="spiffy5"></b></b>

<div class="spiffyfg">
<!-- content goes here -->
</div>

<b class="spiffy">
<b class="spiffy5"></b>
<b class="spiffy4"></b>
<b class="spiffy3"></b>
<b class="spiffy2"><b></b></b>
<b class="spiffy1"><b></b></b></b>
</div>
END;