php forum
php mysql forum
php mysql smarty
 
Topic Options
#218458 - 06/10/02 09:00 AM Need a method to eliminate the Cat numbers
Ian_W Offline

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 wink 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]
JustDave Offline
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="" />
_________________________
~Dave
ChattersOnline.com

Top
#218460 - 06/10/02 11:15 AM Re: Need a method to eliminate the Cat numbers [Re: sjsaunders]
JoshPet Offline
I type Like navaho

Registered: 11/29/01
Posts: 11330
Loc: Charlotte, NC
Wow that's a good idea Dave. I might just need to roll up my sleeves and try that. <br /><br />I have buttons at the top of each screen for specific categories.... but I have to go back and change all the links when we reorganize categories. It would be cool to just make a slight change once in the config file.<br />
_________________________
Joshua Pettit
www.JoshuaPettit.com
My abilities are for hire.

Top
#218461 - 06/10/02 11:23 AM Re: Need a method to eliminate the Cat numbers [Re: Daine]
JustDave Offline
That 70's Guy

Registered: 06/24/01
Posts: 4097
Thanks. <img src="/forum/images/icons/smile.gif" alt="" /><br /><br />After I posted it I really started to like it myself... LoL<br />It could be handy in various situations. <img src="/forum/images/icons/smile.gif" alt="" />
_________________________
~Dave
ChattersOnline.com

Top
#218462 - 06/10/02 11:47 AM Re: Need a method to eliminate the Cat numbers [Re: sjsaunders]
Ian_W Offline

Veteran

Registered: 02/22/02
Posts: 2575
Loc: England
Looks a good idea. Could just work. <img src="/forum/images/icons/laugh.gif" alt="" /> <br /><br />Do I assume that many of the pages have this code?<br /><br />Ian.
_________________________
Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)

Top
#218463 - 06/10/02 11:53 AM Re: Need a method to eliminate the Cat numbers [Re: Gorlum]
JustDave Offline
That 70's Guy

Registered: 06/24/01
Posts: 4097
I would think that any page that needs to load information dealing with posts would have this code in them.
_________________________
~Dave
ChattersOnline.com

Top
#218464 - 06/12/02 07:20 AM Re: Need a method to eliminate the Cat numbers [Re: sjsaunders]
Ian_W Offline

Veteran

Registered: 02/22/02
Posts: 2575
Loc: England
Question - is there any php software around (that you know of) that would do a global search of all .php pages in a particular folder.<br /><br />For that matter, what is a decent php editing package (apart from wordpad <img src="/forum/images/icons/wink.gif" alt="" /> )<br /><br />I think I will try and see if this works!<br /><br />Ian.
_________________________
Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)

Top
#218465 - 06/12/02 11:21 AM Re: Need a method to eliminate the Cat numbers [Re: Gorlum]
Rick Offline
Guru

Registered: 05/11/99
Posts: 8373
Loc: Olympia, WA
I just download the trialware of Zend Studio. I've always done my php coding in vi directly on the server but have been looking at something for my laptop. Zend Studio looks powerful, but it might be a bit much for what I need.
_________________________
UBB.threads Developer

Top
#218466 - 06/12/02 12:24 PM Re: Need a method to eliminate the Cat numbers [Re: Gorlum]
AllenAyres Offline

I type Like navaho

Registered: 03/10/00
Posts: 25580
Loc: Texas
ultra edit will do a search of any type/ all types of files for any string. You can display the list to a results window, and/or search/replace for that string. You can specify a particular folder and include all subfolders as well if you choose <img src="/forum/images/icons/smile.gif" alt="" /> <br /> <br />http://www.ultraedit.com
_________________________
- Allen wavey
- What Drives You?

Top
#218467 - 06/12/02 02:31 PM Re: Need a method to eliminate the Cat numbers [Re: Gorlum]
MattyJ Offline
Coder

Registered: 05/11/99
Posts: 788
Loc: Wisconsin
PHPEdit is supposed to be really nice as well... it has a built in debugger, class documenter, and a ton of other nice features. Still in beta, but worth the danger, according to a good friend of mine. <img src="/forum/images/icons/smile.gif" alt="" />
_________________________
--------------------
Matt Reinfeldt
http://www.mattreinfeldt.com/

Top
#218468 - 06/13/02 09:49 AM Re: Need a method to eliminate the Cat numbers [Re: sjsaunders]
Ian_W Offline

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 wink at the moment - but expanding all the time....)

Top
#218469 - 06/13/02 11:47 AM Re: Need a method to eliminate the Cat numbers [Re: Gorlum]
Ian_W Offline

Veteran

Registered: 02/22/02
Posts: 2575
Loc: England
jumper.php is also wrong - but that one has got me stumped! Tried various combinations without joy.<br /><br />Ian.
_________________________
Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)

Top
#218470 - 06/14/02 08:59 AM Re: Need a method to eliminate the Cat numbers [Re: Gorlum]
JustDave Offline
That 70's Guy

Registered: 06/24/01
Posts: 4097
Hi Ian,<br /><br />The search layout may be at fault, not sure. The display shouldn't be affected by the data returned (or not returned). <img src="/forum/images/icons/crazy.gif" alt="" /><br /><br />Yes you could place words into this:<br /><br />$mycategory[canvey] = "1,2,9,17";<br /><br />but threads uses numbers to address the categories so you will (or should never) <img src="/forum/images/icons/wink.gif" alt="" /> see an url with Cat=canvey,2,4,7 in it. <br /><br />The other thing is that if you had an url with a Cat variable set to a word some scripts may see this as the value zero but I'm not 100% sure. (0 = all cats)<br /><br /><br /><br /><br />I'm still loading software and setting things up here. Once I have everything set up I'll look over the search script to see what is going wrong. <img src="/forum/images/icons/smile.gif" alt="" />
_________________________
~Dave
ChattersOnline.com

Top
#218471 - 06/14/02 09:03 AM Re: Need a method to eliminate the Cat numbers [Re: sjsaunders]
Ian_W Offline

Veteran

Registered: 02/22/02
Posts: 2575
Loc: England
Okidoki.<br /><br />BTW - the word option does not work in every case, so forget that (at the moment <img src="/forum/images/icons/wink.gif" alt="" /> )<br /><br />Thanks in advance for having a look.<br /><br />Ian
_________________________
Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)

Top
#218472 - 06/24/02 03:34 AM Re: Need a method to eliminate the Cat numbers [Re: sjsaunders]
Ian_W Offline

Veteran

Registered: 02/22/02
Posts: 2575
Loc: England
I have battled with this additional hack to eliminate the categories, but I think it has beaten me <img src="/forum/images/icons/frown.gif" alt="" /><br /><br />If anyone has any ideas as to how I can get round them, I would be eternally grateful - with at least 100 categories, and potentially 10 times that, I need to find a different method <img src="/forum/images/icons/crazy.gif" alt="" /> <br /><br />Ian
_________________________
Fans Focus - Focusing on Fans of Sport

(Okay - mainly football (the British variety wink at the moment - but expanding all the time....)

Top



Latest Posts
[7.2.1] - Naked shoutbox
by bellaonline
05/05/12 05:00 PM
[7.x] Stop Forum Spam Integration v0.4
by bellaonline
05/05/12 03:53 PM
Shout Box

(Views)Popular Topics
Known public proxy servers 1689885
Integrated Index Page (IIP) 5.3.1 555705
Finished-[6.5.2] Games Arcade Deluxe v1.9 501236
Integrated Index Page (IIP) 5.1.1 415112
TLD Bv2.1 Released - Threads Links Directory 396822
[6.0x] Who's Online 4.0.0 [Finished] 389412
Finished-[6.5.1] Integrated Index Page (IIP) 6.5 330423
Q & A 298663
Slash UBB 266936
[6.3.x] [beta] Hit Hack 2.0 227970
Forum Stats
13621 Members
59 Forums
37191 Topics
295716 Posts

Max Online: 686 @ 06/28/07 07:04 AM

 

 

 
fusionbb message board php hacks