Wingthor Posted February 1, 2011 Report Share Posted February 1, 2011 I am developing a new VMS site. I don't want the "echo $page_content;" in my layout.tpl file. But want to pont to an other tpl file. As it is stated in the 'Editing Template' page in the PHPVMS homepage documentation (http://forum.phpvms.net/page/index.html?record=32), it states that I can put a template dir under my lib/skins/[template), and call it by the fuction Template::Show('whichever.tpl'). I have made a 'test.tpl' file under my skins templates directory directory, and added (Template::Show('test.tpl'); to the layout.tpl file in skin root directory. This generated this error: "Notice: The template file "/phpvms//core/templates/test.tpl" doesn't exist in /phpvms/core/classes/TemplateSet.class.php on line 248" So why does phpvms don't find the test.tpl under my skins directory. I have also noticed the the double '//' between phpvms and core in the error message. The file isn't there anyway. And I want it to look under '/var/www/phpvms/lib/skins'. So is my method wrong? I don't want the template to written over by any update. Regards Wingthor Quote Link to comment Share on other sites More sharing options...
Tom Posted February 1, 2011 Report Share Posted February 1, 2011 You're going to want to leave $page_content in your layout.tpl, otherwise pages won't have their content. To add custom pages, you can either create them through the Pages thing in the admin panel or create your own module to show the template, which would look something like this: <?php class MyPage extends CodonModule { public function index() { Template::Show('mypage.tpl'); } } ?> Which would be in MyPage.php in a core/modules/MyPage/ folder, and to view it would be mysite.com/index.php/MyPage Alternatively, if you're just wanting to edit the homepage, change the code in frontpage_main.tpl Quote Link to comment Share on other sites More sharing options...
Wingthor Posted February 1, 2011 Author Report Share Posted February 1, 2011 You're going to want to leave $page_content in your layout.tpl, otherwise pages won't have their content. To add custom pages, you can either create them through the Pages thing in the admin panel or create your own module to show the template, which would look something like this: <?php class MyPage extends CodonModule { public function index() { Template::Show('mypage.tpl'); } } ?> Which would be in MyPage.php in a core/modules/MyPage/ folder, and to view it would be mysite.com/index.php/MyPage Alternatively, if you're just wanting to edit the homepage, change the code in frontpage_main.tpl Ok, I see. So in the documentation where it states: "As you can see, this is the entire HTML page, with several important variables being output: * <?php echo $page_title ?> - This goes between the title tags * <?php echo $page_htmlhead;?> - This goes right above the </head> tag * <?php echo $page_htmlreq; ?> - This goes immediately following the <body> tag * <?php echo $page_content;?> - This goes where the body of the page (the content) is supposed to show You can use the Template::Show() calls instead of the above ones, it's the same thing. For an example, view the crystal (the default skin) layout.tpl file. If there is a layout.tpl file, then the header.tpl and footer.tpl files will get ignored." That goes for you can choose to use "<?php echo $page_content;?>" or Template::Show('page_content') Ok, thats fine I will find a way. Thanks for a quick reply Regards Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.