Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2004-10-07 22:34:49

Remillard
Plugin Author
From: Lenexa, KS
Registered: 2004-05-16
Posts: 169

Plugin: mdn_section_archive

NOTE: This plugin is completely deprecated by rss_suparchive. I strongly suggest using that plugin to this one as the functionality is much, much better.

Hello,

Well in a another spasm of coding, I chunked out a little bit of archive code. This is a very basic (currently) archive list plugin that accepts a section name parameter (for use on sections when you want to list OTHER section’s articles).

I made it into a plugin in case someone else also needs something very basic. It is currently very beta. It isn’t fancy. I could add functions as I thought of them, or as folks requested if anyone actually uses it ;-). You have been warned.

mdn_section_archive.txt
Current version: 0.3. Updated 2004.10.09.
Changes to 0.3: Fixed a PITA bug, and made it XHTML Strict compatible.
Changes to 0.2: Added class code for the header, and the ul and li elements.

==
<code>
Usage:
<txp:mdn_section_archive section=“aaaa” [headclass=“bbbb”] [ulclass=“cccc”] [liclass=“dddd”] />

This will produce the following html.
<span class=“bbbb”>MonthName Year</span>
<ul class=“cccc”>
<li class=“dddd”> Day : Permalinked Title </li>
<li class=“dddd”> Day : Permalinked Title </li>
<li class=“dddd”> Day : Permalinked Title </li>
</ul/>
… etc. etc. etc. …
</code>
==

Hope someone finds it useful.

Regards,
Remillard

Last edited by Remillard (2004-11-12 19:21:45)

Offline

#2 2004-10-08 15:20:30

schussat
Plugin Author
Registered: 2004-02-24
Posts: 101
Website

Re: Plugin: mdn_section_archive

This works great for me, Remillard. Thanks! As for additional features, how about the possibility of styling the ul? (I popped in a class for the list on my own, but it would be neat to be able to change it without modifying the plugin.)


-Alan

Offline

#3 2004-10-08 21:15:48

Remillard
Plugin Author
From: Lenexa, KS
Registered: 2004-05-16
Posts: 169

Re: Plugin: mdn_section_archive

I’d thought of this but hadn’t decided how I wanted to do it. I think what I will do is add some parameters and allow the user to pass in CSS style names. I would hate to demand that the style for this be named foobar or whatever. CSS-wise, would this be sufficient:

<code> <span id="">Month Year</span> <ul id=""> <li id="">Date : Permalinked Title</li> <li id="">Date : Permalinked Title</li> ... </ul> </code>

Would there be a better way to structure it generically? I could put <div> around the whole thing as well, but that might be overkill. The ID’s might be better as classes too.

Regards,
Remillard

Offline

#4 2004-10-08 21:27:35

schussat
Plugin Author
Registered: 2004-02-24
Posts: 101
Website

Re: Plugin: mdn_section_archive

I agree that mandating a style is probably not the right way to go. Your mockup seems about right to me. As for class versus ID, perhaps either could be allowed, via something like:

<txp:mdn_section_archive section="xxxx" class="foobar" />

OR

<txp:mdn_section_archive section="xxxx" id="foobar" />

In the code, a single php string like $style could be assigned to equal either class=”$class” or id=”$id”, depending on whether a class or id argument is supplied. But maybe allowing both is overkill; I used a class, myself, and also wrapped each separate unordered list in a div of its own. It may indeed be overkill, but it allows for some flexibility that seems to be part and parcel of Txp.

Thanks again.

Last edited by schussat (2004-10-08 21:28:25)


-Alan

Offline

#5 2004-10-09 00:22:38

Remillard
Plugin Author
From: Lenexa, KS
Registered: 2004-05-16
Posts: 169

Re: Plugin: mdn_section_archive

I’ve updated it with classes. Check the usage listed in the top post (also in the plugin help text.)

Remillard

Offline

#6 2004-10-09 18:02:19

schussat
Plugin Author
Registered: 2004-02-24
Posts: 101
Website

Re: Plugin: mdn_section_archive

The styles work great, but the plugin is now only retrieving the entries from the oldest month in my archive (that is, I have four entries in January 2002, and that’s the only month displayed; to check this out further, I created a test entry and put it in 2001, and it became the only entry displayed). I took a quick look at the date code, but am not entirely sure what I’m looking for. Are you encountering this behavior, too?


-Alan

Offline

#7 2004-10-10 01:31:43

Remillard
Plugin Author
From: Lenexa, KS
Registered: 2004-05-16
Posts: 169

Re: Plugin: mdn_section_archive

Unfortunately yes. I probably should have continued to mark it ‘beta’ as I chucked in the code that added the tags, but I didn’t touch anything else. But there appears to be some unintended consequences and I didn’t test it last night. I’m debugging now.

Remi

PS EDIT: It’s been fixed. It was a case of the dangers of cut and paste. In this case, the code that started the month and year change I had cut and pasted from the “first article” string. Well there’s a fundamental difference in the first and the rest. The first article doesn’t have a string to append to. So it was starting the string new every single new month time. Essentially the last month was only printed because it never went through a year or month change. It was sort of a pain in the tuckus to find. The thing was retrieving everything fine from the database, so it took a lot of print_r’ing in the loop section to figure it out (when it was so simple).

However it’s fixed. The current version is marked 0.3. I also fixed up some XHTML Strict issues (e.g. you can’t have <br/> after <li></li>.)

Last edited by Remillard (2004-10-10 02:34:25)

Offline

#8 2004-10-10 04:51:32

schussat
Plugin Author
Registered: 2004-02-24
Posts: 101
Website

Re: Plugin: mdn_section_archive

That did the trick. Thanks again! Nice plugin.


-Alan

Offline

#9 2004-10-27 17:56:22

pospel
Member
From: Ukraine
Registered: 2004-02-23
Posts: 40
Website

Re: Plugin: mdn_section_archive

Thanks! Nice plugin. I am still investigating it usage, but i advise you to replace all span’s because it oftenly is used to hide text data. It’s handy when using image background for headers etc.

span
{
display: none;
}

Another great idea to add number of comments leaved for a each post in this way:
Article title (58)

Last edited by pospel (2004-10-27 18:02:19)

Offline

#10 2004-10-27 18:56:00

Remillard
Plugin Author
From: Lenexa, KS
Registered: 2004-05-16
Posts: 169

Re: Plugin: mdn_section_archive

Hmmm. I’m not sure I understand the point about spans. I would be loathe to switch it to a header class simply because that might be inflexible. If someone already has a header class defined, they may not want the archive headers formatted the same way. I could go with divs, but I tend to use those for large blocks, and use span for line item sorts of things.

The comments is a good idea. I’ll consider it.

Thanks for the ideas!

Regards,
Remillard

Offline

Board footer

Powered by FluxBB