|
|
Joined: Oct 2006
Posts: 67
journeyman
|
journeyman
Joined: Oct 2006
Posts: 67 |
Im running 7.2.2 and have some problems with using PHP in custom box. The script works, but not in a custom box.I get a parse error What am I doing wrong?
$body = <<<EOF
<?
$feed = simplexml_load_file("http://www.dr.dk/nyheder/service/feeds/allenyheder");
$taeller = 0;
$antal = 5;
foreach($feed->channel->item as $item){
while($taeller<$antal){
if (strlen($item->description) > 35) {
$item->description = substr($item->description , 0, 35);
}
print ("<a href='{$item->link}' target='_blank'>{$item->title}</a><br/>");
print ("<i>{$item->pubDate} </i><br/>");
print ("{$item->description}... <br/><br/>");
break;
}
$taeller ++;
}
?>
EOF;
trosfrihed.dk Custom Ubb 7.5.2
|
|
|
|
Joined: Jun 2006
Posts: 3,837
Carpal Tunnel
|
Carpal Tunnel
Joined: Jun 2006
Posts: 3,837 |
You need to put php code beneath
/* PHP CODE HERE, IF NECESSARY */
And without the <? and ?>
|
|
|
|
Joined: Jan 2004
Posts: 2,474 Likes: 3
Pooh-Bah
|
Pooh-Bah
Joined: Jan 2004
Posts: 2,474 Likes: 3 |
Hmmm... I've been using this with no probs. $body = <<<EOF
<?php include("/path/to/headlines/pr-headlines.txt"); ?>
EOF;
|
|
|
|
Joined: Jun 2006
Posts: 3,837
Carpal Tunnel
|
Carpal Tunnel
Joined: Jun 2006
Posts: 3,837 |
Fair enough - having thought about it, it should work as this is valid within an html page.
Apologies.
|
|
|
|
Joined: Jan 2004
Posts: 2,474 Likes: 3
Pooh-Bah
|
Pooh-Bah
Joined: Jan 2004
Posts: 2,474 Likes: 3 |
Still M25 chums right?
|
|
|
|
Joined: Jun 2006
Posts: 3,837
Carpal Tunnel
|
Carpal Tunnel
Joined: Jun 2006
Posts: 3,837 |
I avoid that car park if I can!
|
|
|
|
Joined: Jun 2006
Posts: 9,242 Likes: 1
Former Developer
|
Former Developer
Joined: Jun 2006
Posts: 9,242 Likes: 1 |
What's the actual parse error that you get?
|
|
|
|
Joined: Oct 2006
Posts: 67
journeyman
|
journeyman
Joined: Oct 2006
Posts: 67 |
I can update the custom box, but when I go to the Url I get a parse syntax error:
Parse error: syntax error, unexpected '=' in /..../.../.../.../trosfrihed.dk/forums/cache/portal_box_2.php on line 12
trosfrihed.dk Custom Ubb 7.5.2
|
|
|
|
|
|