Previous Thread
Next Thread
Print Thread
Hop To
7.3.b4 : Custom Island #210793 04/28/2008 4:04 AM
Joined: Oct 2006
Posts: 67
arentzen Offline OP
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 [Re: arentzen] #210794 04/28/2008 4: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 [Re: Ian] #210801 04/28/2008 6:19 AM
Joined: Jan 2004
Posts: 2,468
driv Offline
Offline
Joined: Jan 2004
Posts: 2,468
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.2
Re: 7.3.b4 : Custom Island [Re: driv] #210804 04/28/2008 6: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 [Re: Ian] #210805 04/28/2008 6:29 AM
Joined: Jan 2004
Posts: 2,468
driv Offline
Offline
Joined: Jan 2004
Posts: 2,468
Still M25 chums right? wink


Using version :: 7.7.2
Re: 7.3.b4 : Custom Island [Re: driv] #210808 04/28/2008 6: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 [Re: Ian] #210818 04/28/2008 10:27 AM
Joined: Jun 2006
Posts: 9,243
Rick Offline
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 [Re: Rick] #210842 04/28/2008 4:23 PM
Joined: Oct 2006
Posts: 67
arentzen Offline OP
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

Forum Search
ShoutChat Box
Comment Guidelines: Do post respectful and insightful comments. Don't flame, hate, spam.
Recent Topics
Followed List v7.7.2 Question
by Ruben - 11/12/2019 12:22 PM
UBB Dev
by JAISP - 11/03/2019 11:01 AM
Exceeded Number of attachments
by rbrtgrmn - 11/02/2019 9:57 PM
Forum New User Registration
by kf6zpl - 10/25/2019 10:45 AM
Having issue with redirects to UBB classic URLs
by amciotola - 10/16/2019 12:11 AM
Who's Online Now
1 registered members (Ruben), 81 guests, and 415 spiders.
Key: Admin, Global Mod, Mod
Random Gallery Image
Latest Gallery Images
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
(Snapshot build 20191023)