Page 1 of 1

Multiple template for a single page

Posted: Wed Apr 28, 2010 7:26 pm
by mauri
Hello everyone.

If I understood correctly, accessibility means (also) make content available to as many people as possible.

In this context, it is useful to offer users the possibility to freely change CSS.
For example, you can develop different css for one (or more) templates: a standard one, another with high contrast color ... and so on ...
This, I believe, is feasible, for example, using js and/or cookies.

My question is: it's possible do something similar with the page template?

For example, you can have a page and display it with a template (template-1) (with many graphics, a menu on the right, one above and one below...), and with a simpler template (template-2) (minus graphics with a single menu after contents), and a template-n ...
Is not a "simple" change of css-style, but change the structure of the page (loading also different css and other resources), leaving the same content.

Thanks in advance.

Mauri

Re: Multiple template for a single page

Posted: Fri Apr 30, 2010 9:25 pm
by Dr.CSS
You can make a new template/css and then copy the page then assign a new template to it...

Re: Multiple template for a single page

Posted: Tue May 04, 2010 6:24 am
by mauri
is what I already do (and I'll do yet, I believe)

In this way, the content of the pages may be not aligned!
Imagine having (just) 30 pages (maybe in 3 languages) ... and 3 "templates" (standard, high legibility and "mobile") ...
To update the contents of a page, now I have to change 9 pages! (Must be identical in all languages and all templates)

That is why I posted the message under "accessibility": because those who read the high legibility version, must see the same content as who read the standard version...

Thanks

Re: Multiple template for a single page

Posted: Tue May 04, 2010 8:00 am
by Peciura
I assume main content goes to "standard" section and others are  copies only. Lets say you need to mirror content from page 'contacts' (content_id == 72) . Do it like that

1.a

Code: Select all

{capture assign=root_url}{root_url}{/capture}
{fetch file="$root_url/index.php?page=contacts&showtemplate=false"}
1.b  or even better

Code: Select all

{cms_selflink href='contacts' urlparam='&showtemplate=false' assign='link_to_main_content'}
{fetch file=$link_to_main_content}
2. other option - use plugin "content_dump" this_only == content_id

Code: Select all

{content_dump  assign='main_page_data' this_only=72 block_name=content_en do_smarty='compile'}
{$main_page_data[0]->content->data}
3. another option -  use module CGSimpleSmarty. Content should be the same as in page 'contacts'

Code: Select all

{$cgsimple->get_page_content('contacts','content_en','main_page_data')}{eval var=$main_page_data}
With any of these tags you will have to edit translations only.
IMO options 2. and 3. loads page less than 1. ,also they are more versatile, but option 1. does not require  additional plugin or module.