Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
<blockquote>And change it to this:
<pre>
// Status
$statmap = array(‘draft’ => 1, ‘hidden’ => 2, ‘pending’ => 3, ‘live’ => 4, ‘sticky’ => 5);
</pre>
</blockquote>
It works! Adding that line, you can output a list of articles published as “sticky”. :D
But, please, rdtietjen (or any plug-in developer), check if this is the only change needed to support “sticky” status.
I’m not a PHP developer, so I really dont know if what I have done is the right way or if the changed I made has any collateral damage, or is something has to be added to this line:
<code>$status = isset($statparts) ? ‘(’ . join(’ OR ‘, $statparts) . ‘)’ : ‘ status = 4 ‘;</code>
Finally, I want to add that if this plug-in works flawlessly, it will become one of the most powerful plug-ins for TXP (specialy for manage static sites and also for have semi-dynamic semi-static sections).
If it works as expected, it will be in my Top 3 plugin, below mdn_if_section (I have an special feeling for <del>Manfre</del><ins>Remillard</ins>‘s plug-in (sorry for the author plug-in confusion), it was the first plug-in I tested).
Edit: I forgot to add this:
as in article_custom, in rdt_article_menu the “sortby” attribute accepts the value “custom_<i>n</i>” to sort your article list by the value in custom field <i>n</i>.
I comment this, because in the <a href=“http://textpattern.net/wiki/index.php?title=Txp:article_custom_/”>documentation about article_custom</a>, this hasnt been added.
Many thanks for this plug-in, rdtietjen!
Last edited by maniqui (2005-10-25 20:45:17)
Offline
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
> maniqui wrote:
> <blockquote>And change it to this:
<pre>
// Status
$statmap = array(‘draft’ => 1, ‘hidden’ => 2, ‘pending’ => 3, ‘live’ => 4, ‘sticky’ => 5);
</pre>
</blockquote>
OK, I updated the plugin for sticky status, fixed the UL class=”“ bug that you described and checked as far as I could your complaint about default. The following code works for me.
<code>
<txp:rdt_section_menu class=”“ default=“Home” />
<txp:rdt_section_menu class=“blivet” default=“Home” />
<hr />
<txp:rdt_article_menu status=“sticky” />
</code>
> Many thanks for this plug-in, rdtietjen!
you’re welcome, glad you like it.
TV? Buglight for humans.
Offline
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
> rdtietjen wrote:
<blockquote>OK, I updated the plugin for sticky status, fixed the UL class=”“ bug that you described and checked as far as I could your complaint about default. </blockquote>
Thanks for replying, rdtietjen!
This works like a charm!
> rdtietjen wrote:
<blockquote>and checked as far as I could your complaint about default.</blockquote>
Finally, I get it.
I was using the “order” attribute for the tag, but I didnt had understood that I also need to include there the “default” section.
So, now I have
<code><txp:rdt_section_menu wraptag=“ul” break=“li” class=”“ active=“active” id=“primario” default=“Portada” order=“default,noticias,enlaces,acerca-nuestro,contacto” /></code>
and it works perfectly.
Last, a“complain” related to what I write in the above post: the plug-in applies various classes and ids (by default) that cannot be overriden. There is also a hardcoded part of the id attribute for the “li“s (or the breaktag chosen) in rdt_section_menu: there is a “menu_” that only can be removed by editing the plug-in.
Also, there are other classes applied that cannot be removed, like de <i>section name</i> applied to the wraptag of rdt_section_menu, like <code><ul id=“primario” class=“menu section_name” /></code> (replace <i>section_name</i> for the section name).
I know this is <strong>inocuos</strong> and no coder/tag wil be harmed by having a superfluos class/id.
But for those obsesive-compulsive users like me, if our code is “dirty” we can get sick. ;)
I understand that this extra id/classes are there for one reason: to have the posibility of high customization, by styling each element in a unique way.
But, for those who want to remove extra class/ids that are applied by the plug-in, you can comment the following lines
Near the bottom of the plug-in edit form:
<pre>
<code>
// next line commented to remove the extra ids in breaktags
// $tagatts[] = ‘ id=“menu_’.strtolower($sect).’”’;
</code>
</pre>
And at the bottom of the plug-in
<pre>
<code>
// next line commented to remove extra classes in the wraptag of rdt_section_menu
// $class = (!empty($class)) ? “ class=’$class $s’” : “ class=’$s’”;
</code>
</pre>
This plug-in really rocks.
Last edited by maniqui (2005-10-25 02:49:11)
Offline
#94 2005-11-02 15:15:24
- Finnish
- Member

- From: Russia, Vladivostok
- Registered: 2005-11-02
- Posts: 13
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
Hi. I like your plugin. It almost fits all my needs.
Except for one.
how do i make it add ‘active’ class attribute to a <code><a></code> tag instead of <code><li></code>?
e.g. i want to get <code><li><a class=‘current’ …>…</code> tag instead of <code><li class=‘current’><a …>…</code>?
Last edited by Finnish (2005-11-02 15:25:08)
have a nice day :)
Offline
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
<blockquote>how do i make it add ‘active’ class attribute to a <a> tag instead of <li>?</blockquote>
I dont know if that is possible, but also, I think it isn’t necesary.
Adding “active” to the “li” tag gives more options when styling.
You can add styles to the active “li”, and also to the “a” tag inside the “li”.
In your stylesheet
li.active {
…styles for the active li….
}
li.active a {
…styles for the “a” tag inside the li.active….
}
Offline
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
> Finnish wrote:
> Hi. I like your plugin. It almost fits all my needs.
Except for one.
what maniqui said.
(is right)
TV? Buglight for humans.
Offline
#97 2005-11-04 05:53:55
- Finnish
- Member

- From: Russia, Vladivostok
- Registered: 2005-11-02
- Posts: 13
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
hi.
i had to modify the code:
<code>$linkref = preg_replace(“/\/default/”,”“,$linkref);</code>
to
<code>$linkref = preg_replace(“/\/default/”,”/”,$linkref);</code>
to make the link to homepage work in opera 8.5 like in IE 6.0 with sect/id/title permalink mode.
without this modification opera treated link with empty href as a link to current section.
have a nice day :)
Offline
#98 2005-11-04 05:55:02
- Finnish
- Member

- From: Russia, Vladivostok
- Registered: 2005-11-02
- Posts: 13
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
now it points to a root of website :)
have a nice day :)
Offline
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
> Finnish wrote:
> now it points to a root of website :)
is that what you want or is that a problem if txp is in a subdirectory?
what version are you using? My versions 0.8 and 0.9 already have
<code>
// for order=“default,xxx,yy”: remove /default
$linkref = preg_replace(“/\/default/”,”/”,$linkref);
</code>
TV? Buglight for humans.
Offline
#100 2005-11-06 17:17:43
- newnomad
- New Member
- Registered: 2005-06-11
- Posts: 5
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
How about making this a nested list istead of 2 seperate lists?
Offline
#101 2005-11-07 01:20:16
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
> newnomad wrote:
> How about making this a nested list istead of 2 seperate lists?
why don’t you mock up the HTML you’d like to be emitted?
TV? Buglight for humans.
Offline
#102 2005-11-07 09:20:57
- newnomad
- New Member
- Registered: 2005-06-11
- Posts: 5
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
<div id=“navcontainer”>
<ul>
<li><a href=”#”>Milk</a>
<ul>
<li><a href=”#”>Goat</a></li>
<li><a href=”#”>Cow</a></li>
</ul>
</li>
<li><a href=”#”>Eggs</a>
<ul>
<li><a href=”#”>Free-range</a></li>
<li><a href=”#”>Other</a></li>
</ul>
</li>
<li><a href=”#”>Cheese</a>
<ul>
<li><a href=”#”>Smelly</a></li>
<li><a href=”#”>Extra smelly</a></li>
</ul>
</li>
</ul>
</div>
sublists are the articles, main lists the sections
isn’t this sementically more correct?
OT
how does one insert code here?
Offline
#103 2005-11-11 16:30:48
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
> newnomad wrote:
> How about making this a nested list istead of 2 seperate lists?
<small>(I think)</small> This is not possible with the current version of the plug-in. Also, I think it will not be possible with future versions.
But maybe you can hardcode it easily, and also keep some dynamic functionality.
<code>
<ul>
<li><a href=”/milk”>Milk</a>
<ul>
<txp:article_custom section=“milk” form=“title” status=“sticky” />
</ul>
</li>
<li><a href=”/eggs”>Eggs</a>
<ul>
<txp:article_custom section=“eggs” form=“title” status=“sticky” />
</ul>
</li>
<li><a href=”/cheese”>Cheese</a>
<ul>
<txp:article_custom section=“cheese” form=“title” status=“sticky” />
</ul>
</li>
</ul>
</code>
Then, you add an article form name “title”, with this inside:
<code><li><txp:permlink><txp:title /></txp:permlink></li></code>
That’s all.
@ rdtietjen
I have wrote this tutorial for building static/dynamic site with dynamic two/three level nav
It’s all based in your plug-in. :D
Offline
#104 2005-11-14 21:55:28
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
I’m having a little issue with this plug-in.
I’m using this code:
<txp:rdt_article_menu active="active" class="" id="secundario" limit="5" sortby="custom_1" sortdir="asc" status="sticky" /> As expected, this simple outputs a list with article titles.
The problem is: when i’m in the section frontpage (/_section_), the first “li” in the list get class="active" applied .
The expected behaviour is: not to add class="active" to any article list item in section frontpage (because there isnt a real current article: we are in an article_list context, not in individual page).
I have tested this in two txp installations and in both the class="active" is added to the very first list item (in the list generated by rdt_article_menu) when you are in article_list context.
<b>@ rdtietjen</b>
I have seen that you also have the same “problem” in your site, at http://publishingpipelines.com/articles
When you are in that URL (/articles, that is a section frontpage), you have the first article list item (“Building a pipeline” at the moment of writing this) highlighted.
The “true” is you are not in individual-article context, but because in your /articles section you show only the last article (“Building a pipeline” article, in this case), it makes sense to highlight it as it is the “current” article. Do I explain myself?
So, my question/request is:
can you add an attribute to highlight (ie. add class="active") only when you are in individual_article context?.
With this attribute turned on, if you are in section frontpage (article_list context), none of the article list items (generated by rdt_article_menu) gets class="active" applied. And if you are in individual_article context, then the class is applied to the current article.
With this attribute turned off, you keep the actual behaviour.
The idea is that this new attribute changes the behaviour between the actual behaviour and the one I suggested.
To make it a sentence:
“Add class active to current article when in section frontpage? Yes/No”
Thanks!
ps: the tutorial I wrote about how to do static sites with rdt_dynamenus will lost credibility if the first item in the “subnav” menu gets class=“active” applied when you are in the section frontpage ;)
Last edited by maniqui (2005-11-14 23:59:58)
Offline
#105 2005-11-14 22:06:44
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
Add something to clarify:
I have found this comment in the plug-in code: /* if no ID we’re in list mode, at a section, so tag first article with class=active */
That behaviour is the one I want to change. I dont want to tag first article with class active at a section. :D
Many few words to explain all my previous post.
Offline