A painting of me

If Section Different Plugins

   8 November 2005, the wee hours

This plugin will let you use two new conditional tags when building pages, <txp:rsx_if_next_section_different /> and <rsx_if_prev_section_different />. I use these tags to display my link-log mixed in with my regular posts. <txp:rsx_if_next_section_different /> is true if the current article’s section is different than the next article’s section. If the current article is the first article this condition is always true. <txp:rsx_if_prev_section_different /> is true if the previous article’s section is different than the current article’s section. If the article is the last article on the page this condition is always true. You can use <txp:else /> as you would expect.

Download the plugin: rsx_section_conditionals.txt.

Update: Damn it! I just noticed that you need edit your publish.php file to use this plugin, thus making it even more niche. You will need to add the following line of code to publish.php, after the line 766: $out['posted_rsx'] = $Posted;. (The previous line of code should be: $out['posted'] = $uPosted;.) We must do this because the plugin needs to have access to the database value Posted, which is not stored by default. (The unix timestamped version of the value is stored, but this is not much use.)

 

Comments

  1. That plugin is using getNeighbour which makes a query each time. Potentially problematic on larger pages.

    I think in your case, you can also use

    < txp:if_different >

    < ! - - < txp:section / > – - >

    ...here some html stuff that should show…

    < /txp:if_different >

    Additionally there is if_first_article and if_last_article (including “else”).

  2. This plugin predates all these new changes. I only published it yesterday because I changed it so it used fewer queries. Since you guys updated the benchmarking when In test mode, I learned that it used to take about 140 queries to build the front page. 140! You suggestion sounds promising, I’ll try it out later today.

    Update: I'm not sure if_different will work for me. I'll need to look in to how it actually functions later, but it dosen't seem to do anything when I use it here. Perhaps because I over ride the article list form when I make display these link-log posts.

Don't be shy, you can comment too!

 
Some things to keep in mind: You can style comments using Textile. In particular, *text* will get turned into text and _text_ will get turned into text. You can post a link using the command "linktext":link, so something like "google":http://www.google.com will get turned in to google. I may erase off-topic comments, or edit poorly formatted comments; I do this very rarely.