Previous Thread
Next Thread
Print Thread
Hop To
7.3.b4 : Custom Island
#210793 04/28/2008 5:04 AM
Joined: Oct 2006
Posts: 67
journeyman
OP Offline
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
Re: 7.3.b4 : Custom Island
arentzen #210794 04/28/2008 5:31 AM
Joined: Jun 2006
Posts: 3,837
Ian Offline
Carpal Tunnel
Offline
Carpal Tunnel
Joined: Jun 2006
Posts: 3,837
You need to put php code beneath

/* PHP CODE HERE, IF NECESSARY */

And without the <? and ?>

Re: 7.3.b4 : Custom Island
Ian #210801 04/28/2008 7:19 AM
Joined: Jan 2004
Posts: 2,469
Offline
Joined: Jan 2004
Posts: 2,469
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; 



Using version :: 7.7.4
Re: 7.3.b4 : Custom Island
driv #210804 04/28/2008 7:23 AM
Joined: Jun 2006
Posts: 3,837
Ian Offline
Carpal Tunnel
Offline
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.

Re: 7.3.b4 : Custom Island
Ian #210805 04/28/2008 7:29 AM
Joined: Jan 2004
Posts: 2,469
Offline
Joined: Jan 2004
Posts: 2,469
Still M25 chums right? wink


Using version :: 7.7.4
Re: 7.3.b4 : Custom Island
driv #210808 04/28/2008 7:57 AM
Joined: Jun 2006
Posts: 3,837
Ian Offline
Carpal Tunnel
Offline
Carpal Tunnel
Joined: Jun 2006
Posts: 3,837
I avoid that car park if I can!

Re: 7.3.b4 : Custom Island
Ian #210818 04/28/2008 11:27 AM
Joined: Jun 2006
Posts: 9,243
Former Developer
Offline
Former Developer
Joined: Jun 2006
Posts: 9,243
What's the actual parse error that you get?

Re: 7.3.b4 : Custom Island
Rick #210842 04/28/2008 5:23 PM
Joined: Oct 2006
Posts: 67
journeyman
OP Offline
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 Box
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Ubb 7.7.4 Gallery problems
by jjjjj - 05/25/2020 2:35 PM
7.7.4 error after php upgrade to php 7.0
by Ruben - 05/25/2020 1:10 PM
7.7.4 move group all, fails with a error
by Ruben - 05/24/2020 3:07 PM
Grid lines in forum topics list
by Steve C - 05/23/2020 12:09 PM
Who's Online Now
2 members (Gizmo, cegadm), 69 guests, and 45 robots.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
3D Creations
3D Creations
by JAISP, December 30
Artistic structures
Artistic structures
by isaac, August 29
Stones
Stones
by isaac, August 19
Amusing Terain Scenics
Amusing Terain Scenics
by isaac, August 19
Sky places
Sky places
by isaac, August 19
Powered by UBB.threads™ PHP Forum Software 7.7.4