Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#13 2004-10-04 19:13:57

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: [plugin] [ORPHAN] spc_section_alias - Section renaming and management plugin.

One additional reason to add multi-group functionality (one that actually breaks things):

Here’s the situation. I’ve got the sections grouped into two groups for the purpose of spitting out two side-by-side lists of available sections. They are grouped based on relative similarity (design/development). This is workable and fine in all aspects – and the kludge we spoke about earlier solves all potential issues.

However, if I’m within an article form and want to output the section title based on the article’s assigned section, I have to specify what group it’s in in order for it to output any section at all. Since I have no idea which article is being viewed and because I can’t specify more than one group, the section alias isn’t output. Making a separate article form for every group is silly (and still probably wouldn’t fix anything). So now I’m at a loss as to what to do.

Edit… hmm I guess I could perhaps string together multiple section_alias tags in my article form, one per group

Edit… yes that seems to work

Last edited by compooter (2004-10-04 19:23:27)

Offline

#14 2004-10-04 20:02:22

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: [plugin] [ORPHAN] spc_section_alias - Section renaming and management plugin.

Just thought of an additional mod that might make it easier on those who like the option of styling the active tab of the <code><li></code> based on the current section. <del>If you were to add <code>$s</code> as a global variable to <code>spc_section_alias_iterate()</code></del>, you could add an optional attribute to specify whether to output like this:

<pre>
<ul> <li id=“nav-default”><a href=”/”>Home</a></li> <li id=“nav-articles”><a href=”/articles/”>Articles</a></li> <li id=“nav-about”><a href=”/about/”>About</a></li>
</ul>
</pre>

Then it’d be easy for everyone to have the option to use page specific styles by using body id’s, such as (ALA method):
<pre>
body#home #nav-default,
body#articles #nav-articles,
body#about #nav-about { background-color: #009900; font-style: bold; }
</pre>

To make it even easier, it’d also be nice to be able to add id or class as optional parameters.

Edit: d’oh – I guess it wouldn’t be <code>$s</code>… it’d be whatever value you’re using to iterate through the true non-aliased section names.

Edit: double d’oh… I see that you’ve already incorporated the id feature. However, it’s sticking the id inside the anchor tag rather than the <code><li></code>

Last edited by compooter (2004-10-04 22:11:43)

Offline

#15 2004-10-04 23:08:55

spchampion
Archived Plugin Author
Registered: 2004-06-10
Posts: 62

Re: [plugin] [ORPHAN] spc_section_alias - Section renaming and management plugin.

Good suggestions. I hadn’t planned on making an update to this thing until after I moved to 1.0rcwhatever, but I’ll move my plans forward.

It seems like the best option for the article tag problem is to make group accept a list of groups. That seems to be the most extendable in terms of solving as many problems as possible, but it prevents you from using a “,” in your group name. I’ll accept that as a loss.

As for the li vs. anchor problem…. Hmmm…. I’ll see what I can do. However, I’m not sure I understand what you’re asking with respect to $s. Would you mind elaborating a bit?

Last edited by spchampion (2004-10-04 23:13:28)

Offline

#16 2004-10-04 23:26:40

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: [plugin] [ORPHAN] spc_section_alias - Section renaming and management plugin.

Sure thing. Actually, my reference to $s was incorrect (as d’oh’d above). What I’d like to do is be able to have the flexibility to place the id on the <code><li></code> ($break) rather than be forced to use it on the anchor tag within the <code><li></code>.

The trouble comes in that the function <code>spc_section_alias_linkencode()</code> is what appends the id to the anchor tag, and that function is what builds the link in <code>spc_section_alias_iterate()</code>.

I’ve considered adding another optional parameter to linkencode(), $appendID, default value = true. Then you’d be able to specify whether or not to append the id to the anchor. But this still feels kludgy. Either way, that doesnt get me around the problem encountered with the way join() takes the whole array into a string. It sort of makes it impossible to iterate thru and add id=”$id” to each separate section’s <code><li></code>.

Any ideas?

Offline

#17 2004-10-07 00:37:26

spchampion
Archived Plugin Author
Registered: 2004-06-10
Posts: 62

Re: [plugin] [ORPHAN] spc_section_alias - Section renaming and management plugin.

Brand new version with big, big changes. See the changelog for version 0.4 and 0.4.1 for details. This takes care of both of compooter’s requests as well as adding a new feature that I’ve been thinking about for a while: namely you may now redefine section entries as you use them.

Say you’ve got a bunch of sections, you’re iterating them, and you want bold tags to appear around the section you are presently viewing (let’s say it’s named articles). Let’s also say that articles is in group ‘2’, but it could also be in ‘1’ or ‘3’ (see compooter’s post above about this). Do the following:

Copy the current values for articles somewhere else (note that this only copies the current section):

<code>
<txp:spc_section_alias_copy srcgroup=“1,2,3” destgroup=“temp” />
</code>

Change the existing value using the new ‘this’ values (see above):

<code>
<txp:spc_section_alias namethis=”<b>.this.</b>” group=“1,2,3” />
</code>

Do your iterate:

<code>
<txp:spc_section_alias_iterate wraptag=“ul” break=“li” group=“1,2,3” />
</code>

Then, change the value back to the way it was:

<code>
<txp:spc_section_alias_copy srcgroup=“temp” destgroup=“1,2,3” />
</code>

I’m hoping I found all of the bugs. If something doesn’t look right, please post a message here and I’ll look into it.

Last edited by spchampion (2005-08-25 14:42:04)

Offline

#18 2004-10-07 00:49:10

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: [plugin] [ORPHAN] spc_section_alias - Section renaming and management plugin.

{stamp of approval} if you’re already using this plugin, you should definitely check out the updates… adds a whole hell of a lotta flexibility.

thanks, stanton!

Last edited by compooter (2004-10-07 00:50:08)

Offline

#19 2004-10-07 04:47:54

spchampion
Archived Plugin Author
Registered: 2004-06-10
Posts: 62

Re: [plugin] [ORPHAN] spc_section_alias - Section renaming and management plugin.

My pleasure! Good luck with your site!

Offline

#20 2004-10-07 04:51:16

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: [plugin] [ORPHAN] spc_section_alias - Section renaming and management plugin.

Actually it’s not my personal site, but an internal intranet of sorts. Well, more of an internal guidelines/standards/design/development resource for the company I work for. So far it’s been well-received & wouldn’t have been as easy w/out the section aliasing.

Offline

#21 2004-10-07 19:30:21

akb
New Member
From: Media, Pennsylvania
Registered: 2004-09-30
Posts: 7
Website

Re: [plugin] [ORPHAN] spc_section_alias - Section renaming and management plugin.

If the following message does not appear, please – someone – let me know how to escape the angle brackets. I copied the post to a word processor and inserted a ‘.’ before each [

Ok, I do not know what happened. I just installed 0.41 and suddenly my alias based navigation menu broke.

This tag:

[txp:output_form form=“Navigation” /]

calls this form (Navigation):

[ div id=“navcontainer”]
[ ul id=“navlist”]
[ li][a href=“http://blogs.domainname.com/index.php”]Home[ /a][ /li]
[ txp:spc_section_alias_iterate form=“NavBar” group=“blogs” /]
[ /ul]
[ /div]

which, in turn, calls this form for iteration (NavBar):

[ li][txp:spc_section_alias_link /]
[ txp:mdn_if_section section=”[txp:spc_section_alias_section /]”]
[ ul id=“subnavlist”]
[ txp:asy_category_list break=“li” /]
[ /ul]
[ /txp:mdn_if_section]
[ /li]

The output I get now is solely from the first form (Navigation) where it is asked to output the first list item (Home). This was working beautifully yesterday when using spc_section_alias v.0.3.

At the same time this broke, my front page also broke. It used to list out the latest 5 articles for each section, grouped by section. I used the tag:

[txp:spc_section_alias_iterate form=‘fpage” group=“blogs” /]

which called the form (fpage) for iteration:

[h3][txp:spc_section_alias_link /]
[txp:spc_section_alias_description /][/h3]
[txp:article_custom form=“default” section=”[txp:spc_section_alias_section /]” limit=“5” sortby=“Posted” sortdir=“desc” listform=“Front” /]

How can I fix this using v.0.41? Why did it break?

Last edited by akb (2004-10-07 20:31:33)

Offline

#22 2004-10-07 21:21:23

spchampion
Archived Plugin Author
Registered: 2004-06-10
Posts: 62

Re: [plugin] [ORPHAN] spc_section_alias - Section renaming and management plugin.

akb, first of all, let’s you get back to 0.3 where things worked for you. Download it here.

Now, let me see if I can figure this out.

Offline

#23 2004-10-07 21:29:52

spchampion
Archived Plugin Author
Registered: 2004-06-10
Posts: 62

Re: [plugin] [ORPHAN] spc_section_alias - Section renaming and management plugin.

akb, just for reference, can you post your section_prefix? Also, you can escape the angle brackets by putting ‘<‘pre’>’ ‘<‘code’>’ HTML Here ‘<’/code’>’ ‘<’/pre’>’ in the text box. Leave off the quotes.

Last edited by spchampion (2004-10-07 21:32:41)

Offline

#24 2004-10-07 21:39:36

spchampion
Archived Plugin Author
Registered: 2004-06-10
Posts: 62

Re: [plugin] [ORPHAN] spc_section_alias - Section renaming and management plugin.

akb, this is just an “I just want to make sure” question, but did you remember to activate the plugin when you upgraded it? Make sure it says ‘Yes’ under Active on the Plugins page. I know I’ve made this mistake more than once, and it describes your symptoms exactly.

Last edited by spchampion (2004-10-07 21:51:58)

Offline

Board footer

Powered by FluxBB