This great tutorial is written by Robin Lindström alias Divining official moderator on jSeblod CCK forums. Many thanks.
About index2
The index2.php is simply a template file used to control listings (or previews, or intros - there are actually kinda endless of possibility's if you just use your imagination) . An example is when you create an menulink showing articles of an selected category using the 'Category Blog Layout' menu item - with index2.php you can control which elements that should appear, and the placement of them.Another example is when you use an module to present your article intros, it's the same there - the quick presentation is all an result of index2.php.
So - lets begin!
Step 1 - the first steps to your own template.
1) Logon to the administration backend and head to the 'Content type manager'.2) Find your 'Content type' and tick the checkbox.
3) Scroll down, at the bottom of the 'Content type manager'-page you will find a feature called 'Template generator'.
4) By default the 'Template generator' dropdown will be set to 'Content', and as that is what you want leave it there and click the 'Generate'-button.
Now you will be prompted by the browser about what to do with 'your_template.zip', just save it where you can find it - then extract it.
1) Open up the extracted folder.
2) Locate and open templateDetails.xml in your favorite editor (if you don't have any XHTML & CSS experience I would recommend Dreamweaver, otherwise Coda (by Panic, Mac only))
3) Add the following line under :
css/style.css
4) Add the following line underindex.php
index2.php
5) Save and close templateDetails.xml
6) Create a new file in the template root directory named 'index2.php'
7) Add the following information to the top of your 'index2.php' file:
4) Add the following line under
index2.php
5) Save and close templateDetails.xml
6) Create a new file in the template root directory named 'index2.php'
7) Add the following information to the top of your 'index2.php' file:
// No Direct Access defined( '_JEXEC' ) or die( 'Restricted access' ); ?> /** * Init jSeblod Process Object { !Important; !Required; } **/ $jSeblod = clone $this; ?> // Add CSS $document =& JFactory::getDocument(); $document->addStyleSheet( $this->baseurl.'/templates/'.$this->template.'/css/style.css' ); ?>
8) Now we have the basics done. Lets move on to making your selected content appears as an "article preview".
2) Copy the the fields that you want to show on your 'Article preview page' (in your case the 'Blog Layout Page').
3) Paste the desired fields into your 'index2.php', and start creating 'div's to hold your content in place, ex:
Step 2 - Let your creativity flow!
1) Open up the templates 'index.php' - here you will find all available content fields, example:YOUR FIELD NAME->value;
2) Copy the the fields that you want to show on your 'Article preview page' (in your case the 'Blog Layout Page').
3) Paste the desired fields into your 'index2.php', and start creating 'div's to hold your content in place, ex:
<?php YOUR TITLE FIELD->value; ?> <?php By: content->author ?> <?php content->category ?> <?php nm_button_read->value; ?>
4) Save your 'index2.php' and upload your new theme via jSeBlod Template manager.
5) Go to your 'Content type' and assign your new 'Content template'.
6) Check on the category layout page (this assumes that you have filtered the results down to the category using the template - and that you are using the previously mentioned parameters).
If you where using the 'default content' template before - the 'article mainpage' might look a little different. If you don't want to have your custom style to the mainpage - then you have to copy and replace your templates 'index.php' from with the one from the 'Default content' template.
Also - I told you to add an line for the CSS to load, when you are ready to style it using CSS. Just create your style.css and place it in the templates 'css' folder.
5) Go to your 'Content type' and assign your new 'Content template'.
6) Check on the category layout page (this assumes that you have filtered the results down to the category using the template - and that you are using the previously mentioned parameters).
If you where using the 'default content' template before - the 'article mainpage' might look a little different. If you don't want to have your custom style to the mainpage - then you have to copy and replace your templates 'index.php' from with the one from the 'Default content' template.
Also - I told you to add an line for the CSS to load, when you are ready to style it using CSS. Just create your style.css and place it in the templates 'css' folder.