Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Multiple/ alternative presentations of individual articles?
I am making a website which essentially holds two shops with the exact same content; a USA shop and a European shop. Every product is one article with a custom field URL_USA and a custom field URL_EUR. The default homepage is the USA overview of products, the /europe page would an overview of the products for european customers.
I want the switch between USA / EUR to be on the homepage, not the individual article pages.
However I cannot find out how to present one article in two different ways, depending on where you come from. If I click on the article in the /europe page, ideally I would be taken to a page that uses a different form to present the article than I get when using the default page. But the presentation of the article is only dependent on the section the article is in, and it cannot be presented in another section, right?
Is there a way to solve this without resorting to cookies or duplicating all articles?
Thanks in advance.
Offline
Re: Multiple/ alternative presentations of individual articles?
I would suggest you to try gbp_permanent_links plugin and see if you can get somewhere with this suggestion
If I were you, I would assign articles all articles to a “products” section.
Then, you have a few options.
Option A) Untested: you could create two categories: “usa” and “europe”, and then, create 4 custom permanent links (using gbp_permanent_links): /section/category1/
and section/category2/ (for listings), and
/section/category1/title@, /section/category2/title
for product permalinks.
Then, you assign each article to both categories (cat1=usa, cat2=europe). Finally, on your page template, you test for the current category (/products/usa/ or /products/europe, when in article list context) category (<txp:if_category>
conditional would be the right tool, but “TXP 4.3.0 is not currently playing nice with gbp_permanent_links“http://forum.textpattern.com/viewtopic.php?pid=236850#p236850; thankfully, there are a few workarounds, so nothing to worry about).
Mmmm, you may hit a dead-end street if you go down that road… particularly, when trying to view the article on its permalink.
But I’ve another option under my sleeve…
Option B) You create other 4 gbp_permanent links using “Plain text” component and 2 page templates (products_usa and products_europe)
/usa/
: this is a permanent link, to be created using gbp_permanent_links, using the “Plain text” component, and you assign it to “products_usa” page template under the Destination fieldset on “Build” tab of gbp_permanent_links./europe/
: idem, but you assign it to “products_europe” template./usa/title/
: another permanent link, for showing an individual product. Again, the first component is “Plain text”, the second one is “title”. On Destination, you it assign it to the “products_usa” template./europe/title/
: idem, but assigned to “products_europe” template.
Finally, you can do this on your “products_usa” template:
<txp:if_article_list>
<txp:article_custom section="products">
<a href="/usa/<txp:article_url_title />"><txp:title /></a>
</txp:article_custom>
<txp:else />
<txp:article><txp:title /> & <txp:body /> and whichever article tags you would like to display</txp:article>
</txp:if_article_lst>
Well, this are the basics for a possible solution. You will have to investigate and try & test a little, but I’m pretty sure you can do what you are trying.
gbp_permanent_links is an undocumented beast that you will have to tame by yourself. But don’t be afraid of this! It’s not that difficult as it may seem. Feel free to come back and ask…
Offline
Re: Multiple/ alternative presentations of individual articles?
Wow, thanks a lot! That plugin did it, what an awesome plugin. But I could not have done it without your help! You can see the shop here
Send me your details, I will send you a shirt! (address, size and what shirt)
Offline
Re: Multiple/ alternative presentations of individual articles?
Hi André,
you are welcome.
Now that I’ve re-read my post, it was full of typos. Glad you find it helpful anyway. :)
And I’m amazed that you tamed the gbp_p_l beast in such short time. Good work.
I’ll look into the shop (nice job! I used to like and read Shakespeare sonnets) and send you an email. Thanks.
Offline