GaVrA Posted May 10, 2009 Share Posted May 10, 2009 I started making headers and footers "dynamically created" via php. that means that same html is used for every page. just like in ipb. now, i usually make headers with tabs that have different background on hover. that hover image is also background image for current page, the page that user is watching atm. that is very easy to accomplish with css when you have more then 1 page. like when i create some web site with 5 pages, then i would have 5 different pages to work with, and it is very easy to accomplish that "current page" effect. but now that i am starting to learn and using php more then ever, i would love to know if there is some way to do this in that 1 header.php file that dynamically creates header for all my pages. something like this: <div id="header_navigation"> <ul> <li <if="1st page opened">class="current_page"</if> ><a title="Vratite se na početnu stranu" href="http://www.crtaci.info/">Početna</a></li> <li <if="2nd page opened">class="current_page"</if> ><a title="Pravila foruma" href="{$this->ipsclass->base_url}act=announce&id=2">Pravila</a></li> <li <if="3rd page opened">class="current_page"</if> ><a title="Download" href="http://download.crtaci.info/">Download</a></li> <li <if="4th page opened">class="current_page"</if> ><a title="Dnevna doza stripova!" href="http://stripovi.crtaci.info/">Stripovi</a></li> <li <if="6th page opened">class="current_page"</if> ><a title="Fanzin crtaci.info foruma" href="http://www.crtaci.info/index.php?autocom=fanzin">Fanzin</a></li> <li <if="7th page opened">class="current_page"</if> ><a title="Imate pitanje? Kontaktirajte nas!" href="http://kontakt.crtaci.info/">Kontakt</a></li> </ul> </div> ofc i would need this for my ipb forum also... :) or maybe there is some easyer way to do this? Link to comment Share on other sites More sharing options...
Management terabyte Posted May 12, 2009 Management Share Posted May 12, 2009 If you tell me how pages are defined I can tell you how to check in which page you are or you mean that you want to check IPB pages from that external header file? (I'm still a bit sleepy lol) Board Rules - Available Products - Need a Custom Work? < Don't PM me for support, post in the forum or submit a ticket from the client area instead! > Link to comment Share on other sites More sharing options...
GaVrA Posted May 12, 2009 Author Share Posted May 12, 2009 I want to use this: http://www.gmarwaha.com/blog/category/client-side/jquery/ but i dont know how to make that background show on coresponding link, eg if board index is opened i want background to be on "Početna", if download page is opened i want "Download" in nav menu to be with background. You can check my nav menu on my site... ;) * Početna * Pravila * Download * Stripovi * Fanzin * Kontakt Link to comment Share on other sites More sharing options...
Management terabyte Posted May 12, 2009 Management Share Posted May 12, 2009 Gosh I have jQuery! I've spent so much time to learn prototype that I don't want to learn also jQuery for now xD There is really no need to use Javascript for that, you can sort out the CSS PHP side but I need to know exactly which code you have in your header.php. If you can't post it there on the public board just PM me the file :) Board Rules - Available Products - Need a Custom Work? < Don't PM me for support, post in the forum or submit a ticket from the client area instead! > Link to comment Share on other sites More sharing options...
GaVrA Posted May 12, 2009 Author Share Posted May 12, 2009 Hmm i am talking about my IPB forum... :) You can see "nav menu" html code in 1st post, the effect i want in my previus post. I can implement this as it is shown on that link, but that would make background show always on "Home" tab(just like on that link)... Also i dont know how to add href value for every link if i have to use it like this href="#"... <ul class="lavaLamp"> <li><a href="#">Home</a></li> <li><a href="#">Plant a tree</a></li> <li><a href="#">Travel</a></li> <li><a href="#">Ride an elephant</a></li> </ul> Link to comment Share on other sites More sharing options...
Management terabyte Posted May 14, 2009 Management Share Posted May 14, 2009 Err no, what I was saying is that you can do it already in your PHP files without adding JS. If you post here your whole header.php I can write the needed code for you :) Board Rules - Available Products - Need a Custom Work? < Don't PM me for support, post in the forum or submit a ticket from the client area instead! > Link to comment Share on other sites More sharing options...
GaVrA Posted May 14, 2009 Author Share Posted May 14, 2009 Lets focus on IPB... ;) So i need it for IPB forums and also for my personal sites, but mainly for IPB. How can i do that? Link to comment Share on other sites More sharing options...
Management terabyte Posted May 16, 2009 Management Share Posted May 16, 2009 As I said post/PM me your header.php code and I'll give you the proper code to highlight the tabs based on the IPB link ;) Board Rules - Available Products - Need a Custom Work? < Don't PM me for support, post in the forum or submit a ticket from the client area instead! > Link to comment Share on other sites More sharing options...
GaVrA Posted May 17, 2009 Author Share Posted May 17, 2009 (edited) Forget about header.php :) lets say i only need this for IPB forum where i dont use header.php :) my site is crtaci.info my navigation menu is this: * Početna * Pravila * Download * Stripovi * Fanzin * Kontakt html for that is this: <div id="header_navigation"> <ul> <li><a title="Vratite se na početnu stranu" href="http://www.crtaci.info/">Početna</a></li> <li><a title="Pravila foruma" href="{$this->ipsclass->base_url}act=announce&id=2">Pravila</a></li> <li><a title="Download" href="http://download.crtaci.info/">Download</a></li> <li><a title="Dnevna doza stripova!" href="http://stripovi.crtaci.info/">Stripovi</a></li> <li><a title="Fanzin crtaci.info foruma" href="http://www.crtaci.info/index.php?autocom=fanzin">Fanzin</a></li> <li><a title="Imate pitanje? Kontaktirajte nas!" href="http://kontakt.crtaci.info/">Kontakt</a></li> </ul> </div> Edited May 17, 2009 by GaVrA Link to comment Share on other sites More sharing options...
Management terabyte Posted May 17, 2009 Management Share Posted May 17, 2009 Quick question: your main forum page is the portal or the board index? Board Rules - Available Products - Need a Custom Work? < Don't PM me for support, post in the forum or submit a ticket from the client area instead! > Link to comment Share on other sites More sharing options...
GaVrA Posted May 17, 2009 Author Share Posted May 17, 2009 board index, but soon it will be ipb portal... :) Link to comment Share on other sites More sharing options...
Management terabyte Posted May 18, 2009 Management Share Posted May 18, 2009 Well then you can use something like that: <div id="header_navigation"> <ul> <li<if="$this->ipsclass->input['act'] == 'idx'"> class="YOUR_ACTIVE_TAB_CLASS_HERE"</if>><a title="Vratite se na početnu stranu" href="http://www.crtaci.info/">Početna</a></li> <li<if="$this->ipsclass->input['act'] == 'announce' && $this->ipsclass->input['id'] == 2"> class="YOUR_ACTIVE_TAB_CLASS_HERE"</if>><a title="Pravila foruma" href="{$this->ipsclass->base_url}act=announce&id=2">Pravila</a></li> <li<if="$this->ipsclass->input['autocom'] == 'downloads'"> class="YOUR_ACTIVE_TAB_CLASS_HERE"</if>><a title="Download" href="http://download.crtaci.info/">Download</a></li> <li<if="$this->ipsclass->input['autocom'] == '???'"> class="YOUR_ACTIVE_TAB_CLASS_HERE"</if>><a title="Dnevna doza stripova!" href="http://stripovi.crtaci.info/">Stripovi</a></li> <li<if="$this->ipsclass->input['autocom'] == 'fanzin'"> class="YOUR_ACTIVE_TAB_CLASS_HERE"</if>><a title="Fanzin crtaci.info foruma" href="http://www.crtaci.info/index.php?autocom=fanzin">Fanzin</a></li> <li<if="$this->ipsclass->input['autocom'] == 'contact'"> class="YOUR_ACTIVE_TAB_CLASS_HERE"</if>><a title="Imate pitanje? Kontaktirajte nas!" href="http://kontakt.crtaci.info/">Kontakt</a></li> </ul> </div> I'm not sure which code uses the subdomain stripovi anyway so I put ??? instead, if you tell me the real link I'll adjust it :) Board Rules - Available Products - Need a Custom Work? < Don't PM me for support, post in the forum or submit a ticket from the client area instead! > Link to comment Share on other sites More sharing options...
GaVrA Posted May 19, 2009 Author Share Posted May 19, 2009 That works... ;) Thnx! My download page is not autocom=downloads, it is this: http://www.crtaci.info/index.php?showforum=84 what to put for that? Link to comment Share on other sites More sharing options...
Management terabyte Posted May 22, 2009 Management Share Posted May 22, 2009 Change:<li<if="$this->ipsclass->input['autocom'] == 'downloads'"> class="YOUR_ACTIVE_TAB_CLASS_HERE"</if>><a title="Download" href="http://download.crtaci.info/">Download</a></li>With:<li<if="$this->ipsclass->input['act'] == 'sf' && $this->ipsclass->input['f'] == 84"> class="YOUR_ACTIVE_TAB_CLASS_HERE"</if>><a title="Download" href="http://download.crtaci.info/">Download</a></li> Board Rules - Available Products - Need a Custom Work? < Don't PM me for support, post in the forum or submit a ticket from the client area instead! > Link to comment Share on other sites More sharing options...
GaVrA Posted May 23, 2009 Author Share Posted May 23, 2009 Thnx man! ;) Link to comment Share on other sites More sharing options...
Management terabyte Posted May 23, 2009 Management Share Posted May 23, 2009 The issue/request this topic was opened for has now been resolved. If you need further assistance, please open a new topic. If this topic was closed prematurely, please contact me so I can re-open it. :) Topic Closed Board Rules - Available Products - Need a Custom Work? < Don't PM me for support, post in the forum or submit a ticket from the client area instead! > Link to comment Share on other sites More sharing options...
Recommended Posts