Adding custom Javascript to concrete5

Permalink
Hi

Hope someone can help me out here Im a newbie with C5
Im planning on building a website with concrete5.
I need to make a online magazine website the website needs to be dynamic (so that each month the content in the pages can be updated through the CMS) But the tricky part is the whole website all pages need to have a flip effect. Something like this:http://www.jpageflip.de/index_en.php...


Im wondering what the right way is to add the javascript coding, do you add it into the template itself or do you add it in concrete5 instalation?

Does anyone knows if concrete 5 has this add on preinstalled or in the market place?

Thnx/
Regards

 
noXstyle replied on at Permalink Reply
noXstyle
Hello,

If you're planning to package your functionality up, the package folder is the right place. Otherwise the scripts should reside within your theme.

The way I probably would go about doing this:

1. Create the theme
2. Create the subpages
3. Load subpages with ajax when flipping (or preload)

That way the site still remains maintainable, will be usable without js and remains more seo friendly.
Job replied on at Permalink Reply
Job
The correct way would be within your theme.

Your folder structure would be something like ...

/theme/theme_name/
 -> /js/
   -> pageflip.js
 -> /css/
   -> view.css
 default.php
 default.css
 home.php
 home.css


In your home/default, the /js/ may/may not be pulled in automatically.

If it doesn't in your default.php, have something like this between your <head> and </head> tags.

<script src="<?php echo $this->getThemePath(); ?>/js/pageflip.css"></script>


I think theres a js() function in the HTML helper, but not sure on what exactly that does. I'd suggest looking at that too and deciding which is the best way.

If this helps be sure to mark it as the correct answer

Job.