Page 1 of 1

Stubborn Variable

Posted: Sun May 18, 2003 10:00 am
by ZED28
Okay, I'm REAL new to PHP but have a handle on some of the fundamental stuff, or at least I'm starting to. I run a PHP Nuke site and I want to have a set of Topic icons that are made for specific themes so I'm trying to modify some of the code in certain modules to pull the topic icons from the themes - instead of the default location. I have successfully modified some code like "submit_news.php" using similar strings but THIS one has me stumped! I've chopped out a part of the code that I'm having problems with. This is the topics.php file from the \Admin\Modules section...

Code: Select all

if (!eregi("admin.php", $_SERVERї'PHP_SELF'])) { die ("Access Denied"); }
$result = sql_query("select radmintopic, radminsuper from ".$prefix."_authors where aid='$aid'", $dbi);
list($radmintopic, $radminsuper) = sql_fetch_row($result, $dbi);
if (($radmintopic==1) OR ($radminsuper==1)) {

/*********************************************************/
/* Topics Manager Functions                              */
/*********************************************************/

function topicsmanager() {
    global $prefix, $dbi, $ThemeSel;
    include("header.php");
    GraphicAdmin();
    OpenTable();
    echo "<center><font class="title"><b>"._TOPICSMANAGER."</b></font></center>";
    CloseTable();
    echo "<br>";
    OpenTable();
    echo "<center><font class="option"><b>"._CURRENTTOPICS."</b></font><br>"._CLICK2EDIT."</font></center><br>"
	."<table border="0" width="100%" align="center" cellpadding="2">";
    $count = 0;
    $result = sql_query("select topicid, topicname, topicimage, topictext from ".$prefix."_topics order by topicname", $dbi);
    while(list($topicid, $topicname, $topicimage, $topictext) = sql_fetch_array($result, $dbi)) &#123;
    echo "<td align="center"><a href="admin.php?op=topicedit&topicid=$topicid"><img src="themes/$ThemeSel/images/topics/$topicimage" border="0" alt=""></a><br>"
    &#125;
I added the variable called "$ThemeSel" to the global list first, then modified the last line of code to pull information from it - except that it's not reading the value of the $ThemeSel" variable for some reason. If I replace the variable with the name of the theme, it works just fine so it is the variable that's causing the problem.

Please please please, you code gurus out there, just cast your experienced eyes over this for just a second! LOL

I know this isn't a hardcore Nuke support forum but figured the syntax is the problem here - that and I'm sure there are more experienced folk here anyways! :wink:

Many thanks!

Posted: Sun May 18, 2003 10:12 am
by volka
where's $ThemeSel supposed to be set?

Posted: Sun May 18, 2003 11:14 am
by McGruff
A long time ago I got hold of nuke, planning to adapt it for a new site. It was such a hideous mess I wrote my own CMS instead.

Many people do seem to use it and like it, but I'd recommend you chuck it away and start from scratch.

Posted: Sun May 18, 2003 12:50 pm
by m3mn0n
Me too. But that's only if you're comfortable with coding your own CMS.

If not, there is a great array of CMS's out their with easier to navigate source.

Posted: Sun May 18, 2003 3:52 pm
by ZED28
volka wrote:where's $ThemeSel supposed to be set?
Okay, remembering I'm new here so writing my own CMS is completely out of the question! LOL As far as telling you where this variable is supposed to be set, I guess I need a little more of an explanation! :oops:

Posted: Sun May 18, 2003 6:50 pm
by m3mn0n
Then i guess you might want to grab one from the link i posted. :wink:

Posted: Mon May 19, 2003 3:47 am
by volka
LOL As far as telling you where this variable is supposed to be set, I guess I need a little more of an explanation!
hm, why did you came up with $ThemeSel? Somehow the name must have come into existance (at least in your mind ;) ).
Simply declaring

Code: Select all

global $GetBillsFunds;
doesn't make me rich (what a pitty :D)