spc Posted March 6, 2013 Share Posted March 6, 2013 Hello I have make a news modules for PS 1.5, the script works fine. but I´m wondering one thing... I dont whant to have it i the left or the right side, I whant to have a link from the blocktopmenu for the service i can offer our customer I use: index.php?id_cms=7&controller=cms&id_lang=1 but I dont now How i can access the blocknews.tpl in the modules... PLEASE HELP..... Link to comment Share on other sites More sharing options...
NemoPS Posted March 6, 2013 Share Posted March 6, 2013 You can edit the blocktopmenu's tpl directly, and place the hardcoded link there (or, if you use a separate page, use getModuleLink('modulename', 'controllername') Be sure you add the link as a list item inside .sf-menu Link to comment Share on other sites More sharing options...
spc Posted March 6, 2013 Author Share Posted March 6, 2013 hello I have follow this step to make a custom page for the news: http://www.prestashop.com/forums/topic/194774-how-can-i-add-a-new-custom-page/ but i dont get it to work Link to comment Share on other sites More sharing options...
NemoPS Posted March 6, 2013 Share Posted March 6, 2013 You can also use my tut here http://nemops.com/creating-new-pages-in-prestashop/ Link to comment Share on other sites More sharing options...
spc Posted March 6, 2013 Author Share Posted March 6, 2013 I have try your script, but I think i´m doind something wrong... I dont get it to work.... Can you help me.... ???? Link to comment Share on other sites More sharing options...
spc Posted March 7, 2013 Author Share Posted March 7, 2013 Hello... I have manage to create the page in the modules/blocknews/controller/front called news.php So now when i go to index.php?fc=module&module=blocknews&controller=news i see a emty page... But now i need to get the info from the blocknews.tpl in the modules/blocknews/ How do i do that. the news.php in the front is this <?php if (!defined('_PS_VERSION_')) exit; Class blocknewsNewsModuleFrontController extends ModuleFrontController { } Link to comment Share on other sites More sharing options...
NemoPS Posted March 7, 2013 Share Posted March 7, 2013 You can't get the info from the tpl, you've got to take it from the module itself, by calling the same funzions used when displaying the block. Use them here instead, and refer to the module as $module->functionname(); Link to comment Share on other sites More sharing options...
spc Posted March 7, 2013 Author Share Posted March 7, 2013 (edited) oki. Can you help me how to type this so i can se the tpl... By the way, where in this world are your location ???? I´m from sweden " Stockholm " Edited March 7, 2013 by spc (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted March 7, 2013 Share Posted March 7, 2013 Well, i don't know your module so i can't really help you with functions I don't know (and of which I don't even know the name) it really depends on your module, just use the same you use in the hookLeftColumn function for example, but be sure you use $module and not $this when referring to the module itself Link to comment Share on other sites More sharing options...
spc Posted March 7, 2013 Author Share Posted March 7, 2013 (edited) this is my HookleftColumn public function hookLeftColumn($params) { $news = $this->getLinks(); $this->smarty->assign(array( 'blocknews_news' => $news, 'title' => Configuration::get('PS_BLOCKNEWS_TITLE', $this->context->language->id), 'url' => Configuration::get('PS_BLOCKNEWS_URL'), 'lang' => 'text_'.$this->context->language->id )); if (!$news) return false; return $this->display(__FILE__, 'blocknews.tpl'); } public function hookRightColumn($params) { return $this->hookLeftColumn($params); } public function hookHeader($params) { $this->context->controller->addCSS($this->_path.'blocknews.css', 'all'); } Edited March 7, 2013 by spc (see edit history) Link to comment Share on other sites More sharing options...
spc Posted March 10, 2013 Author Share Posted March 10, 2013 Can you help me please.....I´m stuck now Link to comment Share on other sites More sharing options...
NemoPS Posted March 11, 2013 Share Posted March 11, 2013 Try this: $news = $this->module->getLinks(); $this->context->smarty->assign(array( 'blocknews_news' => $news, 'title' => Configuration::get('PS_BLOCKNEWS_TITLE', $this->context->language->id), 'url' => Configuration::get('PS_BLOCKNEWS_URL'), 'lang' => 'text_'.$this->context->language->id )); if (!$news) return false; return $this->setTemplate('blocknews.tpl'); Note that the template must follow the folder structure I highlighted in my tut Link to comment Share on other sites More sharing options...
spc Posted March 11, 2013 Author Share Posted March 11, 2013 shoud i put it in the original blocknews.tpl file or in the classes file... Link to comment Share on other sites More sharing options...
NemoPS Posted March 11, 2013 Share Posted March 11, 2013 ...no, in the controller. Have you followed the tutorial? Link to comment Share on other sites More sharing options...
spc Posted March 11, 2013 Author Share Posted March 11, 2013 yes i´m trying..... this is a little bit new for me Link to comment Share on other sites More sharing options...
spc Posted March 11, 2013 Author Share Posted March 11, 2013 I follow your tut, and all i get is blank page Link to comment Share on other sites More sharing options...
NemoPS Posted March 12, 2013 Share Posted March 12, 2013 Maybe you've got some error in your script, try turning errors on Link to comment Share on other sites More sharing options...
spc Posted March 12, 2013 Author Share Posted March 12, 2013 I have the error on... This is what i have done now... news.php in the modules/blocknews/controllers/front <?php if (!defined('_PS_VERSION_')) exit; Class blocknewsNewsModuleFrontController extends ModuleFrontController { $news = $this->module->getLinks(); $this->context->smarty->assign(array( 'blocknews_news' => $news, 'title' => Configuration::get('PS_BLOCKNEWS_TITLE', $this->context->language->id), 'url' => Configuration::get('PS_BLOCKNEWS_URL'), 'lang' => 'text_'.$this->context->language->id )); if (!$news) return false; return $this->setTemplate('blocknews.tpl'); } blocknews.tpl in the modules/blocknews/views/templates/front Link to comment Share on other sites More sharing options...
NemoPS Posted March 12, 2013 Share Posted March 12, 2013 ????? uh... but do you know php OOP? of course it's not working, you've got to place it inside a method. In this case, initContent() as described in the tutorial Link to comment Share on other sites More sharing options...
spc Posted March 12, 2013 Author Share Posted March 12, 2013 now i did like this: in the blocknews/views/templates/front/blocknews.php <!-- Block links module --> {foreach from=$blocknews_news item=blocknews_new} {if isset($blocknews_new.$lang)} <div class="newsletter-archives-block"> <div class="newsletter-archives-block-calendar"> <span class="calendar-month">{$blocknews_new.month|escape}</span> <span class="calendar-day">{$blocknews_new.day|escape}</span> <span class="calendar-year">{$blocknews_new.year|escape}</span></div> <div class="newsletter-archives-block-content"> <h3>{$blocknews_new.url|escape}</h3> <p>{$blocknews_new.$lang|escape}</p> </div> <div class="clear"> </div> </div> <p><img class="separator sep-line" src="1x1.png" alt="" /></p> {/if} {/foreach} <!-- /Block links module --> and in the : blocknews/controllers/front/news.php <?php if (!defined('_PS_VERSION_')) exit; Class blocknewsNewsModuleFrontController extends ModuleFrontController { public function initContent() { parent::initContent(); $news = $this->module->getLinks(); $this->context->smarty->assign(array( 'blocknews_news' => $news, 'title' => Configuration::get('PS_BLOCKNEWS_TITLE', $this->context->language->id), 'url' => Configuration::get('PS_BLOCKNEWS_URL'), 'lang' => 'text_'.$this->context->language->id )); if (!$news) return false; return $this->setTemplate('blocknews.tpl'); } } And i go to the link: index.php?fc=module&module=blocknews&controller=news And I CAN SE THE NEWS :) Thanks so mutch..... Link to comment Share on other sites More sharing options...
spc Posted March 30, 2013 Author Share Posted March 30, 2013 hello... I´m wondering one thing. if i whant to add truncate:320:'..... Read more' in the script. and have a link from the read more to a page there the i can read the full text. How can i do that, do you have a smart idé for that. 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