Dave Egerton Posted December 23, 2008 Share Posted December 23, 2008 I think I may be finally grasping how to have different page layouts depending on what section I am in, but I am my no means a PHP [spam-filter]in header.tpl and footer.tpl, if I do the following: <!-- Center --> {if ($page_name=='index')} {esleif ($page_name=='category')} {else} {/if} And in footer.tpl, replace: {if $page_name!='category'}<!-- Right --> {$HOOK_RIGHT_COLUMN} {/if} Link to comment Share on other sites More sharing options...
bykrmom Posted December 23, 2008 Share Posted December 23, 2008 Viper,I was stumbling around trying to make PrestaShop my own for months, and finally decided I needed to learn about PHP and Smarty (the display code that PHP is using in PrestaShop), so I knew what the changes I was making meant and why they worked. You're on the right track to make alterations to the TPL files to get where you want to go. You can also add to arrays, and other variables in the PHP files to get what you want, and use Smarty to display them.I picked up a book called "Smarty" from PACKT publishing, written by 3 guys that REALLY know their stuff. I devoured it in mere days, and now I am going back through it with a PHP manual by my side to gain an even better understanding. I bought, along with the "Smarty" book, a manual called "Beginning PHP and MySQL5 From Novice to Professional" published by Apress.Armed with both of these books, and taking time to read and digest them, I've been able to do MANY changes that are specific to my needs, and were a mystery to me just weeks ago. For example, I'm in the USA, and the display of the customer addresses was driving me, and my employers, bonkers. We are used to having things a certain way, and the default display wasn't close. With the fresh knowledge from the 2 new books, I was easily able to re-arrange the output in the email alert for new orders, add to an array (in mailaterts.php) and end up with the address display customized to the familiar pattern we see here on this side of the pond. (company name, first and last names, street address, city, state, and zip.)Next I will tackle the same issues in the orders section of the back office display.I would highly recommend a couple weeks with a local test server to play on, and some reading and following examples of code (both the php and tpl code). Once you have these tools, PrestaShop will become less of a mystery and the most wonderful platform for a shop you'll ever encounter.Sorry for the rambling answer... just my two cents worth. Angie Link to comment Share on other sites More sharing options...
Dave Egerton Posted December 23, 2008 Author Share Posted December 23, 2008 Hi Angie,Thanks for your tips, I will get the book.I guess, before I fully got into Prestashop I wanted to make it was right for me, and that it would have the features and design flexibility I was after.So I was trying to see where it limited me as much as anything. I was worried there would not be the flexibility for each pages but I can see not that it is all possible.Would still be nice to know, if applying changes like I suggest is all that is required to change the main div blocks per page - or if there is more to it, but I will try and see how I get onregardsDavid Link to comment Share on other sites More sharing options...
bykrmom Posted December 23, 2008 Share Posted December 23, 2008 David,I don't have a dev site set at the moment to try your changes to those files myself, but you ARE on the right track. All (or at least most of) the display for prestashop is handled with the tpl files. If you can avoid making changes to any php files for display purposes you're better off that way.tpl in this case is the smarty "template" file, and it's strictly a display language created to interract with PHP (although a co-worker and I are trying to adapt it to use with C++ as well).It is a very powerful template engine, and once you read "Smarty", this all becomes much easier to see how the interraction between files takes place. It is truly a very easy language to do very complicated things to the output. I wish I could work with the Presta Team for a few months to see how they think, and how they use Smarty to do all the incredible things that PrestaShop can do. Talk about a good education... I'd be a pro in no time! Hahaha Angie Link to comment Share on other sites More sharing options...
Dave Egerton Posted December 23, 2008 Author Share Posted December 23, 2008 yeh, that might be nice, I have purchased the Smarty book AngieSo I have a busy night ahead I think its time I stepped beyond XHTML, CSS and JQuery Photoshop and Illustrator so this will be fun. regardsDavid Link to comment Share on other sites More sharing options...
ruilong Posted December 24, 2008 Share Posted December 24, 2008 There are some more threads about this, if you just gonna make center column wider or remove right or left columnjust page # in csslike #index #right_column {display:none;} to remove right column on start pageor#category #center_column {widht:1000px;} to make the center column wider on the category pages. Link to comment Share on other sites More sharing options...
Dave Egerton Posted December 24, 2008 Author Share Posted December 24, 2008 Hi ruilongyes, I was aware that I could target CSS like that. It was more about control when I wanted to add new main block divs to the various page sections to be honest.Its only been a week since I started with Prestashop for the first time, but already I am starting to feel more comfortable. My goal is to have a high level of control over each section and exactly what I want to display in those sections. Some of my eCommerce projects need this level of control.I think the idea of targeting the page id and using smarty/php to add those core blocks is probably the way to go for what I want to do, but if I am only changing columns widths and hiding other columns, then CSS alone, as you point out, will do the trickThanks for you post and advice, very much appreciated Link to comment Share on other sites More sharing options...
wojtablo Posted June 1, 2010 Share Posted June 1, 2010 I had the same problem with changing layout based on page id. What you need to do is edit file cms.php and before line: $smarty->display(_PS_THEME_DIR_.'cms.tpl'); add $smarty->assign('CMSID', $_GET['id_cms']); Than edit file cms.tpl in your Themes directory. Now you are ready to add some content depending on page id. For example: {if $CMSID eq '8'} {/if} Maybe there are better solutions but this one let you customize content of your CMS pages, include new files, add GoogleMaps for specified pages. Hope its useful. Link to comment Share on other sites More sharing options...
bimal Posted June 24, 2010 Share Posted June 24, 2010 hey guy's here is the solution. You can try it in your site {if $page_name eq 'index'} Bookmark Us VIP CLUB REFERRAL PROGRAMME LOYALTY PROGRAMME ABOUT US {elseif $page_name eq 'product'} {$HOOK_LEFT_COLUMN} {else} {$HOOK_LEFT_COLUMN} {/if} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now