I have one BIG
Problem</font></b><br>
</p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Anyone knows how
to make this two functions <b>(function GetCatPath</b> <b>and function Get)<br>
</b></font><font face="Verdana, Arial, Helvetica, sans-serif" size="2">to work
totaly different. Problem is that the database in this functions are not defined<br>
</font><font face="Verdana, Arial, Helvetica, sans-serif" size="2">so they work
the same which mixes in scripts.php directory links categories and subcategories<br>
</font><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Example:
I go to scripts.php and goto add script. Categories are displayed good from
first screen<br>
</font><font face="Verdana, Arial, Helvetica, sans-serif" size="2">, but when
i start to brownse in categories, subcategories from links.php starts to appear<br>
</font><font face="Verdana, Arial, Helvetica, sans-serif" size="2">instead subcategories
from scripts.php. </font></p>
<p><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">I did everything
else and all is ok. In the scripts.php I called functions Get, <br>
Parent and Cat and in links.php GetCatPath, GetParents and ViewCat. </font></b><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><br>
There is no collision in tables or in scripts except this two functions (GetCatPath
and Get).<br>
I am messing around with this few days and I can`t find solution.</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">NOTE: I am using
newlinks not links.php from standard phpnuke distribution.<br>
This links are better because your subcategories can have more subcategories<br>
and so forever.<br>
<br>
What I need this for? I develop new and more user friendly download section.<br>
Why to have only categories in downloads without possibility of subcategories<br>
and users to add their own scripts, hacks, addons and later their visitors can
<br>
rate their works.<br>
<br>
I also added in this new downloads few more fields in tables. Price, Version,<br>
Platform, Download URL, Reviews, etc.<br>
I was inspired from hotscripts.com and I combining downloads and links all in
<br>
one. Help me now and I could continue finishing addon so you could later download<br>
it from <a href="http://www.thebix.com">http://thebix.com</a>.<br>
</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">This functions
are in mainfile.php <br>
<br>
<b>And the problem follows:</b></font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"></font>-----------------------------------------------------------------------------------------<br>
</p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>/******************************************************/<br>
/ weblinks functions /<br>
/***************************************************/</b><br>
// Returns the complete path of the category $cid<br>
// $cid : Chosen category<br>
// $links : Boolean to choose is the categories are hyperlinked or not<br>
// $op : To choose the operation of the categories links (if $links is True)<br>
</font></p>
<p><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">(look at this
function "here is the problem" and then go to "function Get"
at the start<br>
</font></b><b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">of
webscripts functions section)</font></b><font face="Verdana, Arial, Helvetica, sans-serif" size="2">
</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>function GetCatPath</b>
($cid=0, $links=False, $op="viewlink"😉<br>
{<br>
global $PHP_SELF;</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> $trail = "";<br>
$Path = Array();<br>
GetParents($Path, $cid);<br>
if(!empty($Path)) {<br>
while ( list ( $key,$Cat ) = each ($Path)) {<br>
$cid = stripslashes($Cat["cid"]);<br>
$title = stripslashes($Cat["title"]);<br>
if ($links) {<br>
$trail = "&nbsp;/&nbsp;<A HREF=\"$PHP_SELF?op=$op&cid=$cid\">$title</A>$trail";<br>
} else {<br>
$trail = "&nbsp;/&nbsp;$title$trail";<br>
}<br>
}<br>
}<br>
if ($links) {<br>
$trail = "<A HREF=\"$PHP_SELF?op=$op&cid=0\">".translate("Main"😉."</A>$trail";<br>
} else {<br>
$trail = translate("Main"😉.$trail;<br>
}<br>
return $trail;<br>
}</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">// Returns the
lists of the parents ids of a category<br>
// &$Path : Array containing the parent category ids<br>
// $cid : Chosen category<br>
<b>(database is defined all is ok with this)</b></font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>function GetParents</b>
(&$Path, $cid=0)<br>
{<br>
$Cat=Array();<br>
if ((empty($cid)) or ($cid == 0)) { return False; }<br>
dbconnect();<br>
$result = mysql_query("SELECT cid, parentid, title FROM <b>links_categories</b>
WHERE cid=$cid"😉;<br>
while ($Cat = mysql_fetch_array($result)) {<br>
$Count = count($Path);<br>
$Path[$Count] = $Cat;<br>
GetParents($Path, $Cat["parentid"]);<br>
}<br>
return true;<br>
}</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">// Displays the
of the subcategories of $cid on two levels<br>
// $cid : Chosen category<br>
// $op : To choose the operation of the categories links<br>
<b>(database is defined all is ok with this)</b> </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b>function ViewCat</b>
($cid=0, $op="viewlink"😉 {<br>
global $PHP_SELF;</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> echo "<br>
<table border=0 cellspacing=10 cellpadding=0><br>
<tr><br>
<basefont size=1><br>
<font face=arial,helvetica><br>
<font size=2>";</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> dbconnect();<br>
$result=mysql_query("select cid, title from <b>links_categories</b> where
parentid=$cid order by title"😉;<br>
$count = 0;</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> while(list($cid,
$title) = mysql_fetch_row($result)) {<br>
$result3=mysql_query("select from <b>links_links</b> where cid=$cid"😉;<br>
$compteur = mysql_num_rows($result3);<br>
echo "<td><font face=Arial,Helvetica size=3><a href=$PHP_SELF?op=$op&cid=$cid><font
size=2 Arial><b>$title</a>&nbsp;<font class=catdescg>($compteur)</b></font><br>";<br>
$result2 = mysql_query("select cid, title from <b>links_categories</b>
where parentid=$cid order by title limit 0,3"😉;<br>
$space =0;<br>
while(list($cid, $stitle) = mysql_fetch_row($result2)) {<br>
if ($space>0) {<br>
echo ",&nbsp;";<br>
}<br>
echo "<font face=Arial,Helvetica size=1><a href=$PHP_SELF?op=$op&cid=$cid";<br>
echo ">$stitle</a>";<br>
$space++;<br>
}<br>
if ($count<1) { echo "</td><td>&nbsp;&nbsp;&nbsp;</td>";
}<br>
$count++;<br>
if ($count==3) {<br>
echo "</td></tr><tr>";<br>
$count = 0;<br>
}<br>
}<br>
$result=mysql_query("select from <b>links_links</b>"😉;<br>
$numrows = mysql_num_rows($result);<br>
echo "</FONT></TD></TR></TABLE><br>
</TD></TR></TABLE></TD></TR></TABLE><br>
</font></basefont><br>
";<br>
}</font></p>
<p></p>
<p> </p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><b>/***************************************************/<br>
/ webscripts functions /<br>
/*****************************************************/<br>
</b>// Returns the complete path of the category $cid<br>
// $cid : Chosen category<br>
// $links : Boolean to choose is the categories are hyperlinked or not<br>
// $op : To choose the operation of the categories links (if $links is True)<br>
<b>(this is new function I make but the database is not defined like in GetCatPath<br>
from above)</b></font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><b> function Get</b>($cid=0,
$links=False, $op="viewlink"😉<br>
{<br>
global $PHP_SELF; </font> </p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> $trail = "";<br>
$Path = Array();<br>
GetParents($Path, $cid);<br>
if(!empty($Path)) {<br>
while ( list ( $key,$Cat ) = each ($Path)) {<br>
$cid = stripslashes($Cat["cid"]);<br>
$title = stripslashes($Cat["title"]);<br>
if ($links) {<br>
$trail = "&nbsp;/&nbsp;<A HREF=\"$PHP_SELF?op=$op&cid=$cid\">$title</A>$trail";<br>
} else {<br>
$trail = "&nbsp;/&nbsp;$title$trail";<br>
}<br>
}<br>
}<br>
if ($links) {<br>
$trail = "<A HREF=\"$PHP_SELF?op=$op&cid=0\">".translate("Main"😉."</A>$trail";<br>
} else {<br>
$trail = translate("Main"😉.$trail;<br>
}<br>
return $trail;<br>
}</font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">// Returns the
lists of the parents ids of a category<br>
// &$Path : Array containing the parent category ids<br>
// $cid : Chosen category<br>
<b>(this is new function I make and database is defined)</b></font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><b>function Parents</b>
(&$Path, $cid=0)<br>
{<br>
$Cat=Array();<br>
if ((empty($cid)) or ($cid == 0)) { return False; }<br>
dbconnect();<br>
$result = mysql_query("SELECT cid, parentid, title FROM <b>downloads_categories</b>
WHERE cid=$cid"😉;<br>
while ($Cat = mysql_fetch_array($result)) {<br>
$Count = count($Path);<br>
$Path[$Count] = $Cat;<br>
GetParents($Path, $Cat["parentid"]);<br>
}<br>
return true;<br>
}</font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif">// Displays the
of the subcategories of $cid on two levels<br>
// $cid : Chosen category<br>
// $op : To choose the operation of the categories links<br>
<b>(this is new function I make and database is defined)</b></font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"><b>function Cat</b>($cid=0,
$op="viewlink"😉 {<br>
global $PHP_SELF;</font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> echo "<br>
<table border=0 cellspacing=10 cellpadding=0><br>
<tr><br>
<basefont size=1><br>
<font face=arial,helvetica><br>
<font size=2>";</font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> dbconnect();<br>
$result=mysql_query("select cid, title from <b>downloads_categories</b>
where parentid=$cid order by title"😉;<br>
$count = 0;</font></p>
<p><font size="2" face="Verdana, Arial, Helvetica, sans-serif"> while(list($cid,
$title) = mysql_fetch_row($result)) {<br>
$result3=mysql_query("select from downloads_links where cid=$cid"😉;<br>
$compteur = mysql_num_rows($result3);<br>
echo "<td><font face=Arial,Helvetica size=3><a href=$PHP_SELF?op=$op&cid=$cid><font
size=2 Arial><b>$title</a>&nbsp;<font class=catdescg>($compteur)</b></font><br>";<br>
$result2 = mysql_query("select cid, title from <b>downloads_categories</b>
where parentid=$cid order by title limit 0,3"😉;<br>
$space =0;<br>
while(list($cid, $stitle) = mysql_fetch_row($result2)) {<br>
if ($space>0) {<br>
echo ",&nbsp;";<br>
}<br>
echo "<font face=Arial,Helvetica size=1><a href=$PHP_SELF?op=$op&cid=$cid";<br>
echo ">$stitle</a>";<br>
$space++;<br>
}<br>
if ($count<1) { echo "</td><td>&nbsp;&nbsp;&nbsp;</td>";
}<br>
$count++;<br>
if ($count==3) {<br>
echo "</td></tr><tr>";<br>
$count = 0;<br>
}<br>
}<br>
$result=mysql_query("select * from <b>downloads_links</b>"😉;<br>
$numrows = mysql_num_rows($result);<br>
echo "</FONT></TD></TR></TABLE><br>
</TD></TR></TABLE></TD></TR></TABLE><br>
</font></basefont><br>
";<br>
}<br>
</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">-------------------------------------------------------------------------------------<br>
-------------------------------------------------------------------------------------<br>
</font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">I hope you will
find solution to make this two functions <b>(GetCatPath and Get) </b>work differently
so<br>
brownsing in sub </font><font face="Verdana, Arial, Helvetica, sans-serif" size="2">categories
in links and scripts could be normal. <br>
<br>
Thanks in advance </font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Happy coding</font></p>
<p> </p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Ivan Strigo</font></p>
<p>