Previous Thread
Next Thread
Print Thread
Hop To
#210793 04/28/2008 4: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 10: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
search error on this site.
by Ruben - 02/24/2024 12:52 PM
UBB 20 Years button
by Morgan - 02/20/2024 4:21 PM
Attachment/Cloudflar
e issue

by Morgan - 02/15/2024 5:47 AM
Forums down
by Nightcrawler - 02/14/2024 2:31 PM
How is this possible?
by Baldeagle - 02/08/2024 2:49 PM
Who's Online Now
3 members (Ruben, ECNet, Morgan), 302 guests, and 368 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)