Previous Thread
Next Thread
Print Thread
Hop To
#210793 04/28/2008 5:04 AM
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?

PHP Code

/* PHP CODE HERE, IF NECESSARY */

/* DO NOT CHANGE THE LINE BELOW */

$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;


/* DO NOT CHANGE THE LINE ABOVE */
 


trosfrihed.dk
Custom Ubb 7.5.2
Joined: Jun 2006
Posts: 3,837
I
Ian Offline
Carpal Tunnel
Carpal Tunnel
I Offline
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
D
Pooh-Bah
Pooh-Bah
D Offline
Joined: Jan 2004
Posts: 2,474
Likes: 3
Hmmm...

I've been using this with no probs.

PHP Code
/* PHP CODE HERE */

/* BODY HERE */
$body = <<<EOF

<?php include("/path/to/headlines/pr-headlines.txt"); ?>


EOF; 


Joined: Jun 2006
Posts: 3,837
I
Ian Offline
Carpal Tunnel
Carpal Tunnel
I Offline
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
D
Pooh-Bah
Pooh-Bah
D Offline
Joined: Jan 2004
Posts: 2,474
Likes: 3
Still M25 chums right? wink

Joined: Jun 2006
Posts: 3,837
I
Ian Offline
Carpal Tunnel
Carpal Tunnel
I Offline
Joined: Jun 2006
Posts: 3,837
I avoid that car park if I can!

Ian #210818 04/28/2008 11:27 AM
Joined: Jun 2006
Posts: 9,242
Likes: 1
R
Former Developer
Former Developer
R Offline
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:
Code
Parse error: syntax error, unexpected '=' in /..../.../.../.../trosfrihed.dk/forums/cache/portal_box_2.php on line 12 


trosfrihed.dk
Custom Ubb 7.5.2

Link Copied to Clipboard
ShoutChat
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
spam issues
by ECNet - 03/19/2024 11:45 PM
Looking for a forum
by azr - 03/15/2024 11:26 PM
Editing Links in Post
by Outdoorking - 03/15/2024 9:31 AM
Question on barkrowler and the like
by Mors - 02/29/2024 6:51 PM
Member Permissions Help
by domspeak - 02/27/2024 6:31 PM
Who's Online Now
1 members (Ruben), 476 guests, and 111 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
Los Angeles
Los Angeles
by isaac, August 6
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20230217)