Converting a HTML Template to concrete5 (pt. 3)

Posted by | October 14, 2013 | concrete5 | No Comments
code-block-1

Picking up where we left off in part 2, we now have a theme that is kinda working. We am not seeing the text styling and the background images because the concrete5 application is not able to correctly resolve the associated files paths for the stylesheet and images. So to get this issue resolved we are going to need a text editor and some PHP. We are going to continue by showing the markup that came with the HTML theme, then we will remove the relevant markup and replace it with PHP. So lets begin.

7 In the original HTML markup, there is a doctype of XHTML which we will change to a HTML doctype for the sake of being HTML5 complient and having access to the associated HTML5 markups such as “articles” and “quotes“. Continuing on we have some static “charset” and “title” tags, let’s replace those with a line of concrete5 PHP which will pull that information automatically. Next piece to look at is the stylesheet, it is located in the root of the theme directory but the concrete5 application need a piece of PHP to resolve the file path correctly. See the code below for clarity.

8 After the above step when we reload the home page, we’ll now see all the text styling and background images called by the CSS stylesheet. At this point all that this is absent on the hompage are the images located in the images folder. Just like with stylesheet the concrete4 application is unable to resolve the path to the images folder. So we can fix this by appending the file path to all the image files with the PHP code we used above with the stylesheet.

9 So after the previous step and another refresh of the homepage, all the images and styling are now being displayed. The theme still has static content but the styling is dynamic. So we are getting there, just a couple more steps. Also the theme’s container div has been pushed down by about 50px. This space being made available for the concrete5 admin toolbar but its not showing. We will fix that by adding 1 line of PHP before the closing “body” tag.

This line of concrete5 PHP will add the necessary div for the toolbar and its needed jQuery UI scripts.

10 Next we will move on to the static navigation bar and change it to one that is dynamic. This is also where we get our first intro to “blocks” and “stacks” – wherein lies the greatest power of concrete5. We will go ahead and create a “stack” with a name of “main Nav” and we’ll also add an “Auto-Nav” content block to it. The term “stack” means that the area is global on all the website pages and the “content block” is an area of pre-defined code such as a contact form or Google map. So in “default.php” where we have an unordered list in the “menu” div we will replace that markup.

So now our website navigation is dynamic and now pulls its items from concrete5’s site map. The only thing now is that the content on the website is still static and uneditable. Also all the pages on the website look the same because they are all using “default.php” to pull their content.

In part 4 we will change the static areas of the website so that it is dynamic and editable. We will also create new page types for the other pages on our website.

Leave a comment

Your email address will not be published. Required fields are marked.

Need to Get Your Business on the Internet? If That is So... Click Here