running external php code on phpbb

Reply Mon 7 Jun, 2004 11:03 am

I built my first php program from reading tutorials (pretty exciting). To explain what I am trying to do, I have a classifieds section and a News section running from Phpbb on my site. I wanted to randomly display one featured ad from my classifieds on top of the News section.

What I've done: I wrote a Php script that ques the Classifieds data base using the Php Random feature with limit 1 attached to the SQL Querry. I tried including the file in PhpBB's overallfooter.php file for testing using an Include tag:
Code:<? include ("../../../my_script.php"); ?>

No results. I learned that the Php is not being parsed. I am hoping to learn how I can have it so my code is parsed into the header.

I was considering using Javascript, but from what I am reading in here, I am thinking that I need to somehow add the code as a function to one of the existing Phpbb files.

Here is the Code a Created
Code:$sql = "SELECT `id` , `attention_getter_url` , `image` , `title` , `description` , `price` , `location_city` , `location_state` FROM `classifieds`

WHERE featured_ad = 1 AND live = 1 ORDER BY RAND() LIMIT 1";

$row = mysql_fetch_array($result);

$id = $row["id"];
$title = urldecode($row["title"]);
$desc = urldecode($row["description"]);
$city = urldecode($row["location_city"]);
$state = urldecode($row["location_state"]);
$price = $row["price"];
$atn = $row["attention_getter_url"];
<table cellpadding="1" cellspacing="1" border="0">
$sql = "SELECT `thumb_url` FROM `classifieds_images_urls` WHERE classified_id = $id";

$row = mysql_fetch_array($result);

$thumb = $row["thumb_url"];
if ($thumb=="")
echo "<th colspan=\"2\" align=\"left\"><font size=\"1\" face=\"arial, helvetica, sans-serif\">Featured Classified Ad</font></th><tr>";
echo "<th colspan=\"3\" align=\"left\"><font size=\"1\" face=\"arial, helvetica, sans-serif\">Featured Classified Ad</font></th><tr><td width=\"98\"

align=\"center\" valign=\"top\" bgcolor=\"#efefef\"><a href=\"../../../index.php?a=2&b=$id\" title=\"$title\"><img

src=\"../../$thumb\" border=\"0\" alt=\"$title\"></a>";
?></td><td valign="top" bgcolor="#efefef" width="200"><a href="../../../index.php?a=2&b=<? echo $id; ?>"><b><? echo $title;

if ($atn=="")
echo "";
echo "<br><img src=\"../../../$atn\" border=\"0\">";
?><br><? echo $city; ?>, <? echo $state; ?><br>
<? if ($price=="0.00")
echo "";
echo "$$price"
?></a></td><td width="300" bgcolor="#efefef" valign="top">
$rest = substr("$desc", 0, 100);
?><a href="../../../index.php?a=2&b=<? echo $id; ?>"><? echo $rest; ?>...</a></td>
  • Topic Stats
  • Top Replies
  • Link to this Topic
Type: Discussion • Score: 1 • Views: 1,813 • Replies: 5
No top replies

Craven de Kere
Reply Mon 7 Jun, 2004 05:28 pm
You just need to call it in the template files as well. I don't have time to show you how, but if you look at the templating system you should see.
0 Replies
Reply Mon 7 Jun, 2004 06:15 pm
Hello Craven,

Thank you for reviewing. I was actually looking at the different php files, but I was unsure which ones to do something to (pagetail, index.php, .inc).

I actually got a solutions that seems to work pretty good. I never heard of this either, but it's pretty exciting to see my first script working with it. Someone suggested to include the script using IFame tag. It did the job, but is not recognizing the font css style sheet.

I am going to try and add some css elements to the Php script itself, see if that will do the job.

If anyone is aware of any drawbacks to using this method, I would appreciate some insight.
0 Replies
Craven de Kere
Reply Mon 7 Jun, 2004 06:18 pm
For the purpose that you are using it for I actually recommend the iframes as it will speed pageloads by making your script load separately. No offense but what you are doing is the antithesis to useability so making it load separately is the least you can do.

If you want quick and easy CSS just include a call to your CSS file in your php code.
0 Replies
Reply Mon 7 Jun, 2004 06:20 pm
Just another question while I am here. How did I do for my first script? Anything that would have made it easier?
0 Replies
Craven de Kere
Reply Mon 7 Jun, 2004 06:49 pm
I didn't read the script. i'm pulling all-nighters with code for a client and am here to take a break from code right now.
0 Replies

Related Topics

In How much time a website can be developed? - Question by aussiejumpingcastle
Webdevelopment and hosting - Question by harisit2005
Showing an Ico File - Discussion by Brandon9000
how to earn money in internet - Discussion by rizwanaraj
The version 10 bug. Worse then Y2K! - Discussion by Nick Ashley
CSS Border style colors - Question by meesa
There is no Wisdom in Crowds - Discussion by ebrown p
THANK YOU CRAVEN AND NICK!!! - Discussion by dagmaraka
I'm the developer - Discussion by Nick Ashley
  1. Forums
  2. » running external php code on phpbb
Copyright © 2021 MadLab, LLC :: Terms of Service :: Privacy Policy :: Page generated in 0.03 seconds on 06/14/2021 at 03:56:10