Custom JS

Permalink 1 user found helpful
Iv been trying to place custome JS in my concrete5 for a while, iv placed it in the themes/mytheme/elements/header.php

it worked but it seamed to be crashing the browser. i font some stuff about duplicating the header_required.php from the concrete/elements into root/elements, but i couldn't get it to work.

so please can someone explain the best way to add custom js to concrete5.

reference site-http://www.onehat.com/blog/2010/04/concrete5-when-and-where-to-incl...

the problem here was its not clear what i actually need to do. sigh...

do i replace
<?php 
$html = Loader::helper('html');
$this->addHeaderItem($html->css('ccm.base.css'), 'CORE');
$this->addHeaderItem($html->javascript('jquery.js'), 'CORE');
$this->addHeaderItem($html->javascript('ccm.base.js'), 'CORE');
$favIconFID=intval(Config::get('FAVICON_FID'));
if($favIconFID) {
   $f = File::getByID($favIconFID); ?>
   <link rel="shortcut icon" href="<?php echo $f->getRelativePath()?>" type="image/x-icon" />
   <link rel="icon" href="<?php echo $f->getRelativePath()?>" type="image/x-icon" />
<?php  } ?>


with

if ($u->isRegistered()) {
   // concrete5 libraries
   $this->addHeaderItem($html->css('ccm.base.css'), 'CORE');
   $this->addHeaderItem($html->javascript('jquery.js'), 'CORE');
   $this->addHeaderItem($html->javascript('ccm.base.js'), 'CORE');


i dont get it???

ecomatt
 
cannonf700 replied on at Permalink Reply
cannonf700
ecomatt,
there's a theme in the market place:
http://www.concrete5.org/marketplace/themes/eye-theme/...
It comes with a java script package/shadowbox.
Take a look at how he implemented the code in his header.php...
also, he includes some illustrations on his website:
http://www.richardet-design.com/concrete5/index.php/shadowbox/...

This should get you started in the right direction.
RadiantWeb replied on at Permalink Reply
RadiantWeb
I wrote this for this type of aplication. to add js to headers on a per/page basis.

http://www.concrete5.org/community/forums/customizing_c5/a-simple-b...

Chad