Hi All,
I am new to using MODx and i am getting a bit confused with converting my website to MODx, i have followed Bobs guide but to no avail.
(1)created a new template and copied the whole of my existing sites home page into it.
(2)amended the CSS file name to point to my existing sites CSS file
(3)removed my content and replaced it with [*content*]
(4)replaced my title tag with <title>[(site_name)] | [*pagetitle*]</title> (left <h2>[*longtitle*]</h2> out as i don’t need it
The issue i have is that my existing site has includes for the (header, left column, right column & footer) on each page like so.
<?php include("header.php"); ?>
<?php include("left-column.php"); ?>
<?php include("right-column.php"); ?>
<?php include("footer.php"); ?>
How do i get these to work still within my template? do i create a snippet for each one and then call them like so?
[[header]]
[[left-column]]
[[right-column]]
[[footer]]
Many thanks in advance (i have moved all of my existing sites, css, javascript, includes & images into the MODx asset folder)
Correct,
If the includes just hold HTML then add them as chunks, if they include php add them as snippets
Thanks for replying,
Because the (header & left-column) are menus, within the snippets would i use wayfinder instead of:
<li><a href="../index.html">Home Page</a></li>
<li><a href="#">About Us</a></li>
<li><a href="#">Contact Us</a></li>
<li><a href="#">The Koi Clinic - Shop</a></li>
<li><a href="#">Free Diary Download</a></li>
<li><a href="../sitemap.html">Sitemap</a></li>
<li><a href="#">Links</a></li>
Also just on my home page, i use a different right column called (mp3-right-column) would i have to create a new template and just assign it to my home page for it just to show on one page.
-
☆ A M B ☆
- 2,213 Posts
Hello,
It really depends on what you need for those elements. The side menus could be wayfinder powered in which case you just put the wayfinder call in your template. The footers could be chunks as your just including standard html code. The right column could be a content TV or a Ditto Feed, or any number of other items.
You can likely eliminate the need for php includes and thus snippets as suggested above without much trouble.
I suppose it would help if i including my existing website: www.thekoiclinic.co.uk
Everypage will have the same header, left-column, right-column & footer and will more then likely only get changed every so often.
but like i said below: my home page (only )has a mp3 player included in the right column, how can i only show it on the home page and on no other pages?
Many Thanks
-
☆ A M B ☆
- 2,213 Posts
Hello,
The header can be in a chunk, the left sidebar wayfinder calls, the right sidebar a chunk (using phx you can hide on pages other than home page if you wish to avoid second template), and the footer can be a chunk. Oh, if you only show the right sidebar on the home page you should modify your template so that extra space is used when a sidebar isn’t present (if you don’t already).
I can post some examples later today when I finish classes. Oh, check the wiki for information on phx the command you would want is something like this: [+phx:if=`[~[*id*]~]:is=``:then=`{{player}}`:else=``+] (Untested from Memory)
Thanks for the help, examples would be great.
The right column is on every page, but only the MP3 player shows on the home page.
At the moment on my existing website i have the following:
mp3-right-column (only shows on homepage)
right-column (exactly the same as above minus the MP3 player, shows on all pages except home page)
It’s not a mortal sin to have two templates, although maintenance is easier if you just have one.
If you want to have just one, this would be one way to do it (just restating some of the suggestions above):
1. for the PHP includes (for now anyway). Just paste the content of the files (assuming that theres no PHP code in the files) into chunks. And insert a {{ChunkName}} tag for each one in the template. If they contain actual PHP code, then they would be pasted in to snippets rather than chunks.
2. For the Sidebar - create a template variable called SideBar and put the content that normally goes in the sidebar on most pages in a chunk called SideBarChunk. Give the template variable (set its type to text) the default value of @CHUNK SideBarChunk.
3. Put [*SideBar*] in the template where you want the sidebar content.
4. Edit the document for the page with the odd sidebar and change the value of the SideBar from @CHUNK to the code for the MP3 player.
5. As an alternative, you might be able to put the MP3 code in a chunk too and just use that chunk’s name in the @CHUNK for the TV on any pages where you want the player.
(I’m on the way out the door so I had to do this in a hurry -- I hope I’ve got it right).