 |
 |
 |
 |
#218458 - 06/10/02 09:00 AM
Need a method to eliminate the Cat numbers
|
Veteran
Registered: 02/22/02
Posts: 2575
Loc: England
|
Hi,<br /><br />I am trying to find a way to eliminate the ?Cat=1,2,3 from URL's in the category view.<br /><br />It is not that I think that people will chop off the end, but rather if I add any new categories, and then sort then into alphabetical order, the URL's will no longer point to the correct sections.<br /><br />Ideally it would be nice if Threads had a separate sorting of categories from their actual numbers - but until this happens I need to find a way to perhaps display ubbthreads.php?Cat=1,2,3 as say section1.php - or even as an index.php in a sub-folder. I would like to avoid a 100% frame, or a simple URL re-direction, as people might bookmark the version with the Cat=1,2,3, and then visit a week later to find different forums (not good!).<br /><br />Any suggestions will be VERY gratefully received.<br /><br />Thanks,<br /><br />Ian
_________________________
Fans Focus - Focusing on Fans of Sport (Okay - mainly football (the British variety at the moment - but expanding all the time....)
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#218459 - 06/10/02 09:18 AM
Re: Need a method to eliminate the Cat numbers
[Re: Gorlum]
|
That 70's Guy
Registered: 06/24/01
Posts: 4097
|
I have an idea that may work. Not sure though and would require some editing. I would set up some variables in the config.inc.php file as follows:<br /><br />$mycategory[0] = "1,2,3";<br />$mycategory[1] = "4,5";<br />$mycategory[2] = "6";<br /><br />Then in every file that uses this:<br /><br /><pre><font class="small">code:</font><hr><br />// -----------------------------------------------------------------<br />// If we have a Cat variable then we need to set it up for the query<br /> if ($Cat) {<br /> $pattern = ",";<br /> $replace = " OR Cat_Number = ";<br /> $catonly = ereg_replace($pattern,$replace,$Cat);<br /> $catonly = "WHERE Cat_Number = " . $catonly;<br /> }<br /></pre><hr><br /><br />change it to this:<br /><br /><pre><font class="small">code:</font><hr><br />// -----------------------------------------------------------------<br />// If we have a Cat variable then we need to set it up for the query<br /> if ($Cat) {<br /> $MyCatArray = split(",",$Cat);<br /> $CatNumber = $MyCatArray[0];<br /> $RealCat = $mycategory[$CatNumber];<br /> $pattern = ",";<br /> $replace = " OR Cat_Number = ";<br /> $catonly = ereg_replace($pattern,$replace,$RealCat);<br /> $catonly = "WHERE Cat_Number = " . $catonly;<br /> }<br /></pre><hr><br /><br />Now only the first number of the Cat variable is used to signify all of the categories.<br /><br /><br />I think this will work. <img src="/forum/images/icons/crazy.gif" alt="" />
|
|
Top
|
|
|
|
 |
 |
 |
 |
 |
 |
 |
 |
#218468 - 06/13/02 09:49 AM
Re: Need a method to eliminate the Cat numbers
[Re: sjsaunders]
|
Veteran
Registered: 02/22/02
Posts: 2575
Loc: England
|
Hi Dave,<br /><br />Getting there....<br /><br />The code that you mentioned only appears in categories.php & ubbthreads.php<br /><br />So also altered...<br /><br />in search.php<br /><br />replace<br /> <pre><font class="small">code:</font><hr>// -----------------------------------------------<br />// If we have a Cat variable we only search those<br /> if ($Cat) {<br /> $pattern = ",";<br /> $replace = " OR Bo_Cat = ";<br /> $thiscat = ereg_replace($pattern,$replace,$Cat);<br /> $catonly = "AND (Bo_Cat = $thiscat )";<br /> } </pre><hr><br /><br />with<br /> <pre><font class="small">code:</font><hr> // -----------------------------------------------------------------<br />// If we have a Cat variable then we need to set it up for the query <br /> if ($Cat) { <br /> $MyCatArray = split(",",$Cat); <br /> $CatNumber = $MyCatArray[0];<br /> $RealCat = $mycategory[$CatNumber];<br /> $pattern = ",";<br /> $replace = " OR Bo_Cat = ";<br /> $thiscat = ereg_replace($pattern,$replace,$RealCat);<br /> $catonly = "AND (Bo_Cat = $thiscat )";<br /> } </pre><hr> <br /><br />and in dosearch.php<br /><br />replace<br /> <pre><font class="small">code:</font><hr> if ($Cat) {<br /> $pattern = ",";<br /> $replace = " OR Bo_Cat = ";<br /> $thiscat = ereg_replace($pattern,$replace,$RealCat);<br /> $catonly = "AND (Bo_Cat = $thiscat )";<br /> } </pre><hr> <br /><br />with<br /> <pre><font class="small">code:</font><hr> if ($Cat) { <br /> $MyCatArray = split(",",$Cat); <br /> $CatNumber = $MyCatArray[0];<br /> $RealCat = $mycategory[$CatNumber];<br /> $pattern = ",";<br /> $replace = " OR Bo_Cat = ";<br /> $thiscat = ereg_replace($pattern,$replace,$RealCat);<br /> $catonly = "AND (Bo_Cat = $thiscat )";<br /> } </pre><hr><br /><br />however we now have the following situation...<br /><br />... displays fine in forums, and the search forums pull down list is correct under the search page, and indeed the search appears to work as well. However when we display the threads from the last 24/48/7 we have the same 'bug' that was in the early beta versions - i.e. several of the threads are displayed in the border colour of the cell rather than the cell colour. See this link as an example.<br /><br />We also need to alter editemail.php, which I assume controls the subscriptions...<br /><br />from<br /> <pre><font class="small">code:</font><hr>// ------------------------------------------------------------------<br />// if we are allowing subscribes then we need to put that on the page<br /> if ($config['subscriptions']) {<br /> if ($Cat) {<br /> $Catchooser = "AND Bo_Cat in ($Cat)";<br /> } </pre><hr> <br />to<br /><br /> <pre><font class="small">code:</font><hr>// ------------------------------------------------------------------<br />// if we are allowing subscribes then we need to put that on the page<br /> if ($config['subscriptions']) {<br /> if ($Cat) {<br /> $MyCatArray = split(",",$Cat); <br /> $CatNumber = $MyCatArray[0];<br /> $RealCat = $mycategory[$CatNumber];<br /> $Catchooser = "AND Bo_Cat in ($RealCat)";<br /> } </pre><hr> <br /><br />(but this appears not to work, as the additional forums are not showing up in the CP subscriptions bit).<br /><br />I also tried altering config.inc.php to <br />// -----------------<br />// Category Variables<br /> $mycategory[1] = "1,2,9,17";<br /> $mycategory[canvey] = "1,2,9,17";<br /> $mycategory[3] = "10,11,12,13,14,15,16";<br /><br />to see if a word work as well, which it does - the weird bit, is in the last 24/48/7 all the cells are dark, but with the number 1 as the category one of the cells is the correct colour <img src="/forum/images/icons/confused.gif" alt="" /> <br /><br />Any thoughts Dave?<br /><br />Regards,<br /><br />Ian<br />
_________________________
Fans Focus - Focusing on Fans of Sport (Okay - mainly football (the British variety at the moment - but expanding all the time....)
|
|
Top
|
|
|
|
 |
 |
 |
 |
|
|