1

Topic: Being "MLP" Friendly

Hi Stuart,
I have some feedback for you. I repost excerpts from my comment on Txp forum slightly modified and add couple of thoughts that occurred to me since then.

A lot of the Internet users and potential customers speak languages other than English. So they might be interested in their own language. A lot of customers and clients for on-line business live in the US and the UK so they might be interested in English interface as well. I think it's better for a commercial theme to be MLP ready.

Some things in Aperture are not.

1. cbs_category_list doesn’t seem to work with MLP. (ap_header_navigation form)

I don’t see any point in using it.

’ type=“article” wraptag=“ul” break=“li” class=“children” />

does exactly the same without any plugins and with MLP support.

2. I don’t see any reason why frontpage_albumN_category_title should be read from a variable. There is the category title, why not use it? I suppose there may be a need to name it differently from category title sometimes, but that flexibility seems to me excessive in 99% of normal usage. I have to maintain two category titles – one in txp, another in theme.
The same is true for sections and the top menu. Even worse – the menu item titles are hardcoded. It amazes me, since there is tag with which you can create linked or unlinked section title.
And it won't work multilingual this way, unless you create snippets with titles in all languages of interest and paste calls to this snippets in the variable fields.

ap_header_navigation form doesn’t feel txp’ish at all. I modified it to read section titles instead of using hardcoded values. Thus I don’t have to update multiple versions of titles, and what is much more important – it works with MLP showing section title in the current language.


I also enter into frontpage_album1_category_title variable field

It works but it's not in line with the whole variable tab idea to make it simple and straightforward for user. If I can enter frontpage_albumN_category name into the proper field I think it should have an option of displaying it's name without txp tags.

Don’t get me wrong, please – I’m very much pleased with the theme, I hope my feedback can make it even better.

2

Re: Being "MLP" Friendly

With "Delegate" I have already reverted to setting "widowed words" to "No".

As for your coding suggestions I thank you and I am looking into them with "Delegate" but you must remember that I have tried to keep things extremely simple for users new to Txp. My view is that the less you have to go in and mess with the code the better it is for them which is why I spent a lot of time modifying Adi's plugin to create the Theme and Widgets plugins. I am well aware that if I had been doing this for my own site I would have done things rather differently.

There are 2 reasons for using variables for the category titles. The first one is that you need to use the category1 or category2 tags to call them automatically and which do you use? You can't use both. A user may have images in both.

The second is that they may not want to display category titles at all and by leaving these variables blank it reduces the height of the block. This may be particularly useful if the user wants to display more than 4 categories which means having a second line of images. I've set the "demo site" to do this as it will show you more clearly than I can explain here.

The reason I hard-coded the topnav is because of wanting to be able to have the category drop-down lists attached to the sections. This seemed a pretty simple way of doing it however you can use a "form" with the <txp:section_list /> tag so again I am going to try this out with "Delegate" and at the same time I shall replace the <txp:cbs_category_list /> with the standard <txp:category_list /> tag to make it "MLP-friendly" and reduce plugin dependency.

I'll let you know how I get on and if it all works I shall post the code here and use it when I do the re-coding.

3

Re: Being "MLP" Friendly

Well I've managed to do it with "Delegate" Sergey but it is really complex code and still has to rely on having "Theme Variables" to specify which sections are being used. In "Delegate's" case this would just be for the weblog but for "Aperture" it would also have to include the photo section, in fact any section that might contain categories. Part of the reason for using <txp:cbs_category_list /> was because it is "section-sensitive".

Anyway this would be the new code for the topnav (Delegate):-

<ul id="nav" class="fl">
<txp:section_list break="" active_class="current_page_item" include_default="1" default_title="Home" exclude="featured-articles,search,tag" form="del_category_list" />
</ul>

And this would be the rather messy code for the "del_category_list" form:-

<li<txp:if_section name='<txp:section />'> class="current_page_item"</txp:if_section>><txp:section title="1" link="1" /><txp:variable name="secname" value='<txp:section />' />
<txp:if_variable name="navigation_display_categories(yes_or_no)" value='yes'><txp:if_variable name="secname" value='<txp:variable name="section_for_weblog" />'><txp:category_list section='<txp:variable name="section_for_weblog" />' wraptag="ul" break="li" /></txp:if_variable></txp:if_variable></li>

For "Aperture", which requires a category list for 2 sections there would have to be a <txp:else /> added so you would end up with something like this (which I haven't actually tried out yet):-

<li<txp:if_section name='<txp:section />'> class="current_page_item"</txp:if_section>><txp:section title="1" link="1" /><txp:variable name="secname" value='<txp:section />' />
<txp:if_variable name="navigation_display_categories(yes_or_no)" value='yes'><txp:if_variable name="secname" value='<txp:variable name="section_for_weblog" />'><txp:category_list section='<txp:variable name="section_for_weblog" />' wraptag="ul" break="li" /><txp:else /><txp:if_variable name="secname" value='<txp:variable name="section_for_images" />'><txp:category_list section='<txp:variable name="section_for_images" />' wraptag="ul" break="li" /></txp:if_variable></txp:if_variable></txp:if_variable></li>

which doesn't look nice at all does it? I'm going to throw it at the "Aperture" demo and see if it works.  wink

4

Re: Being "MLP" Friendly

I missed the issue with "section-sensitive" categories because I had no categories in the blog section. Now I've added one and oops!

<txp:category_list section='<txp:variable name="section_for_images" />' />

lists blog categories among image categories. section parameter just links a category to the section but it doesn't filter it. Too bad.

5

Re: Being "MLP" Friendly

I played around with this for a couple of days and all I got was a headache. In the context that I have used the plugin it is the only way to do this. The standard <txp:category_list /> tag does have a "type" attribute so that you can limit categories to those used for articles however the "section" attribute does not do what you instinctively expect it to do. It simply creates category links pointing to the section specified, which isn't what we want at all.

Anyway I ended up retaining the plugin but using it with the <txp:section_list /> tag. Note how I have used it as a "wrap tag" and the plugin call is inside it:-

<div id="nav_wrapper">
<ul id="nav">

<txp:section_list include_default="1" default_title="Home" sections='<txp:variable name="section_for_weblog" />,<txp:variable name="section_for_images" />,about,contact,archive' break="">
<li<txp:if_section name='<txp:section />'> class="current_page_item"</txp:if_section>><a href="<txp:section />"><span class="left"></span><txp:section title="1" /><span class="right"></span></a>
<txp:cbs_category_list section='<txp:section />' break="li" wraptag="ul" class="children" />
</li>
</txp:section_list>

</ul> <!-- /#nav -->
</div> <!-- /#nav_wrapper -->

Now for the <txp:section_list /> tag I have used the "sections" attribute which has the advantage of determining the display order of the section links. If the order is of no importance to you then the "exclude" attribute could be used instead. Also, for the actual link I haven't used the <txp:site_url /> tag.

The way this is coded, the <txp:cbs_category_list /> tag will pull out categories for any of the listed sections if they exist. It is not restricted to just the weblog and photos.

Something I don't have here, as this is the current code for the "Aperture" demo, is that for "Delegate" I have surrounded the <txp:cbs_category_list /> tag with <txp:if_variable /> tags so users can turn category display off.

Now I know that the standard "section_list" tag is MLP-friendly. I don't know if this way of using it is, or if <txp:cbs_category_list /> is any friendlier, but at least users will have the option to revert to a simple section list if it isn't or if they simply don't want them.

6

Re: Being "MLP" Friendly

My quick & dirty solution:

I created parent categories for the image categories and for the weblog categories and used

<txp:category_list parent="blog-categories" exclude="blog-categories" section='<txp:variable name="section_for_weblog" />' type="article" wraptag="ul" break="li" class="children" />

it includes all children of the parent category without the parent itself.

7

Re: Being "MLP" Friendly

Hi Stuart!

I've got another MLP related problem.
As you probably know with MLP you can access your article with or without language marker.
/en/article1 and /article1 lead to the same article.
URLs without language markers are generated by RSS feeds.

I've got two feeds - one in English, the other - in Russian. If I click a link from RSS feed there may be 2 different results. 
If current browser language is the same as the language of feed(post in feed) – it works as usual. But if the browser language is different from the language of post I get 404 error.


Let’s say I have /ru/odin and /en/one. Before /odin and /one URLs also worked, but now I get 404 from a browser with Russian locale if I try to access /one
Can it be related to the template?

8

Re: Being "MLP" Friendly

I don't think it is template related because aside from the top navigation all other linking is done using standard Txp links/attributes. I don't know enough about MLP to help out here but Els is usually pretty hot on the subject if you want to go ask about it  there. Oh I see you have.  wink

Something else to consider is that when you set up the theme, if you followed my instructions exactly, you will have set the "URL scheme" in "Preferences" to "section/title". Maybe that is a change to how you had it before?

9

Re: Being "MLP" Friendly

No, it was 'section/title' and it still is. Will wait for an answer from Els, then.