3212 Posts in 847 Topics by 809 members
| Go to End | ||
| Author | Topic: | 961 Views |
-
Re: Custom HTML Code / Javascript inserted via CMS

5 March 2013 at 12:21am
I dont know if this got resolved, or if its written somewhere else but this is my FIX:
Use a:
HTMLText
TextareaFieldThen in the CMS wrap your pasted code in:
<!-- MYcode -->
YOUR CODE HERE
<!--End MYcode-->So for example my Rebel Mouse page this is my code:
RebelMousePage.php
<?php
class RebelMousePage extends Page {public static $db = array(
'RebelMouseCode' => 'HTMLText'
);public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.RebelMouseCode', TextAreaField::create('RebelMouseCode','Paste Your Rebel Mouse Code Here: '));
return $fields;
}}
class RebelMousePage_Controller extends Page_Controller {
}And in the CMS:
<!-- RebelMouse -->
<script type="text/javascript" id="rebelmouse-embed-script" src="https://www.rebelmouse.com/static/js-build/embed/embed.js?site=USER&height=1500&flexible=1&skip=about-site,show_rebelnav"></script><!--End RebelMouse-->In the RebelMousePage.ss
$RebelMouseCode
hope this helps someone!
-
Re: Custom HTML Code / Javascript inserted via CMS

13 March 2013 at 2:23am
For the future - may be useful to someone
Use a:
- Text or VarcharIn CMSfield normaly like:
- new TextAreaField
- newTextFieldIn template
$NameField.RAW
| 961 Views | ||
| Go to Top |


