Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2009-03-17 02:53:37

juliane
Member
Registered: 2009-02-08
Posts: 33

two different article displaying system on the same site

how can I create two different article displaying systems using the same articles?

I have a blog with regular image + title + article text.. one article below the other… and now I want to implement an option for users to be able to see on a grid system only the images + title like a mosaic. and I would have a link for both type of views. how can I do this?

do I need to create a new section? but then how can an article be posted to both index and mosaic sections?

or just another page + article form?

thanks.

Offline

#2 2009-03-17 04:34:16

MattD
Plugin Author
From: Monterey, California
Registered: 2008-03-21
Posts: 1,254
Website

Re: two different article displaying system on the same site

This would be very similar to how one would set up an archive section. You can create a new section and display articles for a different or mutiple sections there.


My Plugins

Piwik Dashboard, Google Analytics Dashboard, Minibar, Article Image Colorpicker, Admin Datepicker, Admin Google Map, Admin Colorpicker

Offline

#3 2009-03-17 08:12:31

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,730
Website

Re: two different article displaying system on the same site

If you are talking about essentially two different views of the same information, you could also do this other ways using the same page template:

  1. Use an url variable, e.g. mydomain.com/articles/?display=mosaic and then use a plugin to detect if that so-called GET variable exists in the url and display the same articles with another form. See this thread for more details of a similar question – it works just like a conditional, if urlvar exists, display this way, otherwise the normal way. You might also want to look at adi_gps, which came out since that thread and has better support. If you want the setting to stick, you can also combine the above with chs_cookie to write the current user’s display method of choice to a cookie. Then you just need to make two links to your same section with ?display=list and ?display=mosaic.
  2. Depending on your display, you may also be able to do this with javascript on a single page so you don’t have to reload the page: if you can make your form for list view and mosaic view almost identical in terms of source code structure (your list view will have maybe an excerpt below but otherwise they are identical), then all you need to do is a kind of javascript-based stylesheet switcher that hides the information your don’t need for the mosaic view and changes the float settings so they appear next to each other rather than below each other. Probably the easiest way is to put a wrapper div around your list of articles for example class="listview", make two buttons for list and mosaic view and use two buttons and jquery to change the class of the container div to the respective view, e.g. class="gridview". In your css you then only need to define separate sets of rules for how they display in each container. jquery also has a way of setting cookies if you want your settings to stick. I don’t know the jquery off the top of my head, but neither is complicated and easy to google.

TXP Builders – finely-crafted code, design and txp

Offline

Board footer

Powered by FluxBB