https://www.icyphoenix.com/viewtopic.php?f=36&t=8622 ----------------------------------- DWho Thu 09 Aug, 2012 17:02 Main Links Set To Current Style ----------------------------------- Hi I am making a template for icy2.0 and am trying to achieve so that when a user is on a page the link will highlight through css showing the user they are on that page. As icy is nearly alike to phpbb3 I was reading through their template vars. in icy the code I need is already installed in default.cfg [code linenumbers=false] 'SCRIPT_NAME' => str_replace('.' . PHP_EXT, '', $user->data['page']['page_name']),[/code] and then by placing tags and code in overall_header.tpl for example [code linenumbers=false]
  • Forum
  • Forum
    • [/code] then using id=current in the css file should by rights show the page as highlighted, but sadly it does not. As the coding in icy is all new to be compared to older versions anyone possibly have any ideas if this will work or if I have an error somewhere. Any help would greatly be appreciated and if I get this working I will post a walk through for anyone else who ight need it. :mrgreen: :mrgreen: ----------------------------------- jhl Thu 09 Aug, 2012 19:31 Re: Main Links Set To Current Style ----------------------------------- The variable $breadcrumbs['address'] contains the link for the current page. If you grep for: grep -rn "\$breadcrumbs\['address'\]" * you'll find it's used in pretty much every page. Inside a template it's the 'BREADCRUMBS_ADDRESS' variable. HTH John ----------------------------------- DWho Fri 10 Aug, 2012 13:23 Re: Main Links Set To Current Style ----------------------------------- Thanks for the tip John I couldnt see that for looking, new there was a navigation style in icy but totally forgot about the breadcrumbs. Thanks Mike :mrgreen: :mrgreen: [b]extra comments[/b] I have just had a look at the breadcrumbs which would work ideally but I dont believe they will with what I am trying to do. I need the links to appear in overall header like the image below... [img]http://www.icyphoenix.com/files/images/166/main_liks.png[/img] I have a few custom pages using cms pages and I thought there might be an easy way to show the current page using present code... the breadcrumb system would work if I needed to show the current page without any other links but I need the other links to show too. as I said if this was standard pages in icy then I wouldnt have a problem, it is the cms custom pages that I cannot make it work on. thanks for your help :mrgreen: :mrgreen: ----------------------------------- mort Sat 11 Aug, 2012 05:25 Re: Main Links Set To Current Style ----------------------------------- This should give you something to mess with,. Just drop it all into overall_header.tpl and have a "PLAY"? :mryellow: The Script: [code linenumbers=false]
    [/code] The CSS: [code linenumbers=false] [/code] ----------------------------------- DWho Sun 12 Aug, 2012 12:56 Re: Main Links Set To Current Style ----------------------------------- Thank you Mort Works like a charm :mrgreen: :mrgreen: ----------------------------------- mort Sun 12 Aug, 2012 13:12 Re: Main Links Set To Current Style ----------------------------------- You're welcome. ;) If you are actually using the CSS you can drop this from it (if you haven't already done it? [b]position: absolute; top: 0; right: 10px; [/b] and use this to slot it in wherever you want it etc. :mryellow: [code linenumbers=false]
    BLAH!
    [/code] ----------------------------------- Mighty Gorgon Tue 14 Aug, 2012 19:55 Re: [SOLVED] Main Links Set To Current Style ----------------------------------- It was a bug... please change it like this: [codeblock] 'SCRIPT_NAME' => str_replace('.' . PHP_EXT, '', $user->page['page_name']),[/codeblock] ----------------------------------- DWho Wed 15 Aug, 2012 11:27 Re: [SOLVED] Main Links Set To Current Style ----------------------------------- Thanks Luca Spent ages trying to make it work using your code and nearly gave up. :) code changed works as it should. :mrgreen: :mrgreen: ----------------------------------- mort Sat 18 Aug, 2012 07:38 Re: [SOLVED] Main Links Set To Current Style ----------------------------------- [quote user="DWho" post="56309"]code changed works as it should. :mrgreen: :mrgreen:[/quote] HA! So now you have two ways of doing it. One for php (Change the CONSTANT), and one solely for phpBB (Icy Phoenix). :mryellow: :twisted: ----------------------------------- DWho Sat 18 Aug, 2012 15:23 Re: [SOLVED] Main Links Set To Current Style ----------------------------------- My thoughts exactly.. :mryellow: :mryellow: ----------------------------------- Mighty Gorgon Sun 26 Aug, 2012 11:00 Re: [SOLVED] Main Links Set To Current Style ----------------------------------- [quote user="mort" post="56333"]One for php (Change the CONSTANT), and one solely for phpBB (Icy Phoenix). :mryellow: :twisted:[/quote] If you want your solution to be fully independent from phpBB (Icy Phoenix) you should remove the constant PHP_EXT and use 'php' instead. :P ----------------------------------- Yros Fri 12 Oct, 2012 14:32 Re: [SOLVED] Main Links Set To Current Style ----------------------------------- Update: Informpro made this for me: put it in your CFG file: [code]$page = explode('/', $_SERVER['SCRIPT_NAME']); $page = substr(end($page), 0, -4); if ($page == 'index') { $images['current'] = 'current'; } if ($page == 'blog') { $images['current'] = 'current'; } if ($page == 'about us') { $images['current'] = 'current'; } if ($page == 'contact us') { $images['current'] = 'current'; } if ($page == 'package') { $images['current'] = 'current'; } if ($page == 'login') { $images['current'] = 'current'; }[/code] In your header, you simply will have to add {current} inside the class, such as: [code]Home Forum Blog[/code] Well, if there aren't any other classe to define you can even get some space by using this, I guess: [code]if ($page == 'index') { $images['current'] = 'class="current"'; }[/code][code]Home[/code] and define your class in the css, for example: [code].current {background-color:blue}[/code] Obviously, this require you to set up the array for the $image['current'] variable but you can use it to define it automatically:[code]foreach ($images as $k => $v) $template->assign_var(strtoupper($k), $v);[/code] Well, that's all some tips from Informpro, I'm just sharing. Hope this help.