Adding JS & CSS to a specific page?

Permalink 1 user found helpful
How can I add a JS file and some CSS only to a particular page which otherwise also shares its template with other pages? So far I've come up with these ideas -

1. if block in the template (sounds like a bad workaround)
2. create separate template (overhead of another template)

both these ideas sound pretty hacky. Is there a better way to do this?

Thanks.

 
fastcrash replied on at Permalink Reply
fastcrash
hi baba, you can use addHeaderitem and addFooteritem function

$html = Loader::helper('html');
$v = View::getInstance();
$v->addHeaderItem($html->javascript('jquery.min.js','js'));
$v->addFooterItem($html->javascript('jquery.min.js', 'js'));
$v->addFooterItem("<script type=\"text/javascript\">you js vode here</script>");
$v->addFooterItem($html->css('style.css', 'css'));
//addFooterItem on available in 5.4.2.2
// make sure print out in /element.footer_required.php
print $this->controller->outputFooterItems();


dont think it can help u~
if you mean for specific page, you can use the pID for logic