Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: [archived] glx_hl_current highlight current article
Nell wrote:
<code><ul>
<li id=“dogs”>>a href=”/pets/dogs”<txp:glx_hl_current_article class=“selected” />>Dogs</a></li>
<li id=“cats”>>a href=”/pets/cats”<txp:glx_hl_current_article class=“selected” />>Cats</a></li>
</ul></code>
Is this the correct use for this plugin?
Maybe this is not the problem, but your markup has an error. You’re starting the < a href > this way: > a href >.
…Prrrrrrrr…
Offline
#14 2006-04-11 14:16:16
- Nell
- Member
- From: Mexico City, Mexico
- Registered: 2005-06-21
- Posts: 48
Re: [archived] glx_hl_current highlight current article
Creativesplash, the plugin is activated and I have a .selected class in my CSS. I’m at home right now, but I’ll check later if I’m using it as you did. If it worked for you it should work for me! (or at least I hope so)
TNT, I made a mistake when I typed it in the forum. I changed it to simplify the links so the example was not as complicated. The actual markup is correct, I validated it. Thanks for noticing, though :)
Offline
#15 2006-04-18 17:16:24
- Nell
- Member
- From: Mexico City, Mexico
- Registered: 2005-06-21
- Posts: 48
Re: [archived] glx_hl_current highlight current article
I’m back.
I used it as you suggest, Creativesplash. I think the problem might be with my page or my forms, because it’s not working as it should. For example:
<ul><li>Pets<ul><li>Dogs</li><li>Cats</li><li>Birds</li></ul></li></ul>
When I’m on the section Pets, it highlights dogs, cats and birds, but when I go to any of the articles (dogs, cats or birds), nothing is highlighted.
Last edited by Nell (2006-04-18 17:18:41)
Offline
#16 2006-04-28 01:56:33
- marvix
- Member
- Registered: 2006-04-06
- Posts: 27
Re: [archived] glx_hl_current highlight current article
How to make this work with categories ?
Offline
#17 2007-01-22 16:51:44
- satsilem
- Member
- Registered: 2006-09-20
- Posts: 19
Re: [archived] glx_hl_current highlight current article
The home page of this plugin doesn’t have anything can please someone provide another download link for this plugin?
It is exactly what I need for one of my projects
Thanks in advance
Offline
#18 2007-02-06 10:48:19
- hazel
- Member
- From: Glastonbury, UK
- Registered: 2006-09-22
- Posts: 36
Re: [archived] glx_hl_current highlight current article
satsilem ~ Johan’s page is back up again.
To get this working with categories edit the plugin and add the following, which is just a small mod of the ‘section’ function:
function glx_hl_current_category($atts)
{
global $pretext;
if (is_array($atts)) extract($atts);
$category = (empty($category)) ? "" : $category;
$class = (empty($class)) ? "current" : $class;
$output = ' class="'.$class.'"';
$categories = array_map("trim", explode(",", $category));
$condition = in_array($pretext["c"], $categories);
return ($condition) ? $output : "";
}
Offline
#19 2007-02-06 11:18:52
- satsilem
- Member
- Registered: 2006-09-20
- Posts: 19
Re: [archived] glx_hl_current highlight current article
Bookmarked, downloaded and I am going to test it right now!
Great!
Thank you for sharing the informationOffline
Re: [archived] glx_hl_current highlight current article
Hi! It works great when a section is selected and I could make a separate page for every section so I can have a great navigation. But I wonder if there is any chance of detecting the current section in the output instead of having to state a particular section?
I’ve tried this kind of thing:<code>
<txp:article_custom section=”<txp:section />” form=“recent_article” sort=“Posted desc” /> </code> but it breaks.
It would be great if you could make it work!
Offline
Re: [archived] glx_hl_current highlight current article
Re my last question, I just realised I could do this which isn’t much trouble at all:<code>
<txp:if_section name=“about”>
<txp:article_custom form=“recent_article” limit=“10” section=“about” sort=“Posted desc” /></txp:if_section>
<txp:if_section name=“contact”>
<txp:article_custom form=“recent_article” limit=“10” section=“contact” sort=“Posted desc” /></txp:if_section>
</code> etcetera
It works fine like that :-)
Cheers!
Offline
Re: [archived] glx_hl_current highlight current article
Hi,
I tried the code that was posted to add if_current_category to the plugin (found in this post, however it is not working for me.
Does anyone know why?
Thanks
Last edited by blumie607 (2007-08-12 02:14:26)
bludrop studios .::. Creative Expression
Offline
Re: [archived] glx_hl_current highlight current article
Well, I did some searching and I found the culprit. (at least a solution that works).
The original poster of the code simply copied the glx_hl_current_section code and replaced the [s]
’s with [c]
’s.
Since categories work slightly different than sections, I found that copying the glx_hl_current_article code worked better, because that referenced $pretext
and $thisarticle
.
Then, I just changed [id]
and [thisid]
with [c]
and [category1]
. I’m not sure if there is a way to do category 1 or 2 (there probably is), but I was satisfied with category1.
Below is the PHP I put in the plugin code.
function glx_hl_current_category1($atts)
{
global $thisarticle;
global $pretext;
if (is_array($atts)) extract($atts);
$active = (empty($active)) ? 'current' : $active;
$output = ''.$active.'"';
if ($pretext["c"] == $thisarticle["category1"])
{
return $output;
}
}
Help from this page: Accessing Global Variables in Textpattern
Last edited by blumie607 (2007-08-15 04:25:10)
bludrop studios .::. Creative Expression
Offline
#24 2008-01-25 08:05:04
- simsim
- Member
- Registered: 2006-05-06
- Posts: 70
Re: [archived] glx_hl_current highlight current article
Hello,
Does this plug-in work with clean URLs? I’ve used it in both __misc__-type and __article__-type forms to no avail.
Last edited by simsim (2008-01-25 08:05:23)
Offline