Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#85 2005-10-17 15:28:38
- wondermonkey
- New Member
- Registered: 2005-06-05
- Posts: 5
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
Hey, I’m still getting the following when trying to install:
Notice: unserialize(): Argument is not a string in /home/arianete/public_html/textpattern/include/txp_plugin.php on line 152
Can you send me the original PHP and I’ll just fudge it in myself? Would that be possible?
PLEASE & thanks.
Last edited by wondermonkey (2005-10-18 14:04:28)
Offline
#86 2005-10-18 14:08:07
- wondermonkey
- New Member
- Registered: 2005-06-05
- Posts: 5
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
Okay, so I fudged it in. Multiple /textpattern/ dir uploads, downgrading to RC3, then back, discussions with host, playing with the PHP, swapping PHP with other plugins…
and what seemed to work (honestly I can’t remember at this point) was to take out the <?php & ?> tags. If it was something else my brain didn’t make the correlation.
Anyway, a smaller problem now, would be why this:
txp:rdt_article_menu
wraptag=“ul”
break=“li”
class=“subnav”
active=“active”
id=“articles”
limit=“25”
sortby=“Posted”
sortdir=“desc”
dateposted=“to_date”
section=”“
status=“live”
/>
Is creating HTML like this:
ularticles class=‘subnav’>
li>
a href=‘http://www.arianetech.es/Product-Design/market-studies’>Market Studies
/a>
/li>
/ul>
(I’ve replaced the < with a linebreak as I can’t figure out how to paste in code without it rendering yet)
Notice the first line with the <ul> tag (parses as “ularticles class=‘subnav’ without the “id=”) . Obviously it’s not rendering properly. So far I haven’t found where you parse the UL tag in there. Any help you can offer here?
Ps. Thanks so much for sending me the raw code yesterday!
Last edited by wondermonkey (2005-10-18 14:44:51)
Offline
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
> wondermonkey wrote:
> Okay, so I fudged it in. Multiple /textpattern/ dir uploads, downgrading to RC3, then back, discussions with host, playing with the PHP, swapping PHP with other plugins…
and what seemed to work (honestly I can’t remember at this point) was to take out the
<code><?php & ?> </code>
tags. If it was something else my brain didn’t make the correlation.
huh. i hope you removed all the plugin template apparatus and just used the function definitions in the middle.
> (I’ve replaced the < with a linebreak as I can’t figure out how to paste in code without it rendering yet)
use the forum’s code, /code tags
I just used the tag() function provided by textpattern, did you figger that out?
<code>
// return UL list: $id = (!empty($id)) ? ‘ id=”’.$id.’”’ : ‘’;
$class = (!empty($class)) ? “ class=’$class’” : ‘’;
return tag(implode(“\n”, $out),$wraptag,$id.$class);
}
</code>
TV? Buglight for humans.
Offline
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
Mmmmm… this seems to be a powerful plug-in… I’m installing it right now. I have no doubts that I’m needing a plug-in like this one.
But, in the meanwhile, I have found (looking at the plug-in help and also at the plug-in code) that this plug-in doesnt support <code>status=“sticky”</code>…
Setting articles to “sticky” is more meaningful when you are creating statics websites.
Can this be added in the next version?
I think the support for status=“sticky” will make this plug-in even more powerful and will improve the flexibility of TXP for managing statics sites.
Example:
You can have a section that have both dynamic and static articles.
In that section, you could need a subnav menu (where menu items are generated from the titles of articles saved as “sticky”) and also need a dynamic article list (where the list is generated from articles published as “live”).
So, you can have a section where “sticky” articles can be seen as simple “subsections” and where you can also publish fresh new posts.
So, applying this to a “recipe” section.
Section:
“Recipes”
Subnav menu generated from static “sticky” articles:
<ul><li><a href=”/”>About my recipes</a></li><li><a href=”/”>My grandma’s cooking secrets</a></li><li><a href=”/”>How to extinguish a fire</a></li><li><a href=”/”>Disclaimer (¿?)</a></li></ul>
Article (recipes) list, created from last “live” articles added :
<ul><li><a href=”/”>Mistery Meat (25/10/05)</a></li><li><a href=”/”>Magic Brownies (15/8/05)</a></li><li><a href=”/”>Bitter Birthday Cake (10/8/05)</a></li></ul>
Well, to conclude: <strong>please, add support for “sticky” articles.</strong>
Thanks in advance <small>and excuse my english</small>
Last edited by maniqui (2005-10-24 22:28:38)
Offline
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
I would say the change to support “sticky” status is near here:
<pre>
<code>
// Status
$statmap = array(‘draft’ => 1, ‘hidden’ => 2, ‘pending’ => 3, ‘live’ => 4);
foreach (explode(‘,’, $status) as $stat) {
if (array_key_exists($stat, $statmap)) {
$statparts[] = ‘ Status = ‘ . $statmap[strtolower($stat)];
}
}
$status = isset($statparts) ? ‘(’ . join(’ OR ‘, $statparts) . ‘)’ : ‘ status = 4 ‘;
</code>
</pre>
First, I would look at this line:
<pre>
<code>
// Status
$statmap = array(‘draft’ => 1, ‘hidden’ => 2, ‘pending’ => 3, ‘live’ => 4);
</code>
</pre>
And change it to this:
<pre>
<code>
// Status
$statmap = array(‘draft’ => 1, ‘hidden’ => 2, ‘pending’ => 3, ‘live’ => 4, ‘sticky’ => 5);
</code>
</pre>
But then, we also have this line:
<pre>
<code>
$status = isset($statparts) ? ‘(’ . join(’ OR ‘, $statparts) . ‘)’ : ‘ status = 4 ‘;
</code>
</pre>
And I dont have any idea what to change in that line (of course, if there is the need to change something in that line).
I would appreciate any help to make this plug-in worki with “sticky” articles. Thanks.
Last edited by maniqui (2005-10-24 22:28:02)
Offline
Re: [plugin] [ORPHAN] rdt_dynamenus - automatic section and article menus
I’m testing this plug-in (while waiting the support for “sticky” status ;) )
I have found a little error similar to what wondermonkey posted above (post 86).
In rdt_section_menu, if you use <code>class=”“</code> to override the plug-in default value, the output has an error:
<code><ul id=“primario“acerca-nuestro></code> (it’s bad formed)
where I was specting something like:
<code><ul id=“primario” class=“acerca-nuestro”></code>.
If I dont specify a value for class attribute, I get:
<code><ul id=“primario” class=“menu acerca-nuestro”></code> (I can live with that, no problem)
But I have noticed that each <code><li></code> gets an ID applied, and it doesnt seems to be configurable using the plug-in’s attributes.
I get
<code><li id=“menu_acerca-nuestro”>…blabla….</li>
<li id=“menu_noticias”>….blabla…</li>
</code>
It seems that the user dont have control over the ID applied to each <code><li></code>, or at least, I didnt found how to (i would like no-ID applied to li tag, just the class=“active” to the active one).
Of course, for me, that ID doesnt means any problem but they are few bits in the output that I dont need.
Finally, I cant get working the “default” attribute.
I add <code>default=“portada”</code> to the plug-in tag, but I dont get a link to the home that reads “Portada”.
I just get nothing.
This is a great plug-in that seems to need a few little adjust to work flawlessly.
Offline
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