Jump to content
galactic

Scroller module

Recommended Posts

I want implement javascript text scroller as module. The scroller.html page contain a lot of code, css, and a few internal and external javascripts. What is better way to add this page into module: should I put full scroller.html code into module.tpl file? How it should be done? Or will be better to leave scroller.html page separate, and put into .tpl file a reference to scroller.html and call it from .tpl?

Share this post


Link to post
Share on other sites

Here are some guides for creating a module:

http://doc.prestashop.com/display/PS14/Creating+a+PrestaShop+module

http://www.nethercottconstructions.com/en/content/32-prestashop-development-guide.

 

But for your question, you should copy code from html to tpl file.

And use addJS() and addCSS() functions in header hook to call js and css files.

This code is in module's php file.

Share this post


Link to post
Share on other sites
Here are some guides for creating a module: http://doc.prestasho...estaShop+module http://www.nethercot...velopment-guide. But for your question, you should copy code from html to tpl file. And use addJS() and addCSS() functions in header hook to call js and css files. This code is in module's php file.

 

 

so mymodule.tpl should contain all code without html tags, and we call that .tpl file from mymodule.php which will add the theme's header, footer, etc.?

Edited by galactic (see edit history)

Share this post


Link to post
Share on other sites

Well mymodule.tpl should contain code within body tag, or probably main div.

And js and css files that are linked in head tag goes to mymodule.php in function

like this:

public function hookHeader($params)
{
 Tools::Tools::addJS(($this->_path).'mymodule.js');
 Tools::addCSS(($this->_path).'mymodule.css', 'all');
}

 

Also check out code of default modules, if you have some similar thing to do.

Share this post


Link to post
Share on other sites

how to convert this code to Smarty template mymodule.tpl?

 

<body>

<div class="marquee" id="mycrawler">
<span class="scroll"></span>
</div>

</div>

<div style="display: none;"><div id="nowlisten">
<h2>current track: </h2>
<p class="track">Loading …                                                </p>
</div>

</div>


<script src="http://www.externalurl.com/s77s02e3523fcdbd83e3415bef4.js" type="text/javascript"></script>
<script>
  NS('AudioAddict.API').Config = {
	url:			   'http://api.v2.testaudioadd.com/v1', // 'http://api.v2.testaudioadd.com/v1',
	listenUrl:		 'http://www.url.tk',
	network:		   'di',
	networkName:	   'Some source',
	networkUrl:		'http://www.url.tk/',
	channelBase:	   '/',
	calendarEventBase: '/calendar/event/',
	member:			null
  };
</script>


<script src="http://www.externalurl.com/pages/b7d8e25e114f1efee1838c37fba2b409.js" type="text/javascript"></script>
<script>
	var CurrentChannel = {"channel":{"ad_channels":"8554477917, electronic_stuff, 1124672376","asset_id":58,"asset_url":"http://static.testaudioadd.com/a272766a55dc1d3c5b63e688d7a3d0de.png","channel_director":"Kowboy","created_at":"2010-03-16T18:02:43-04:00","description":"The finest imported on the net!","forum_id":6,"id":69,"key":"testingsource","name":"Classic Stuff Test","network_id":1,"old_id":97,"premium_id":61,"tracklist_server_id":1275,"updated_at":"2011-06-22T13:29:56-04:00"[spam-filter].channel;
</script>
</body>

Edited by galactic (see edit history)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More