Current Record: How to add custom stylesheets and javascript #44

News

Current Record: How to add custom stylesheets and javascript #44

News

Click to minimize this section Details

News id 44
Headline How to add custom stylesheets and javascript
Content Here was the tutorial on how to do it:<br /><br />http://framework.weblite.ca/documentation/how-to/custom_javascripts<br /><br />Basically you just add the code at the delegate class, or application class:<br /><br /><blockquote><br />function block__custom_stylesheets()<br /><br />OR or javascripts:<br /><br />function block__custom_javascript()<br /></blockquote><br /><br />You can also use the dataface application class object which has a function called addHeadContent, and what this does is it will add any thing you enter as a parameter into the slot in the head (the same slot that has the custom stylesheets and javascripts.<br /><br />For example:<br /><br /><blockquote><br />$app =& Dataface_Application::getInstance();<br />$app->addHeadContent("HELLO");<br /></blockquote><br /><br />This will add the words 'HELLO' to the slot section of the html. <br /><br />The main difference between using this addHeadContent function and the block__custom__stylesheet/javascript function is that you can use the addHeadContent function inside any other function. The block__custom__stylesheet function is isn't own separate function that can't be used in any other function.<br /><br />But you can do something like this with the addHeadContent function. For example:<br /><br /><blockquote><br />function field__recent_offerings(&$record){<br />$app =& Dataface_Application::getInstance();<br />$app->addHeadContent("HELLO");<br />}<br /></blockquote><br /><br />So inside of this field function we call the addHeadContent. It has the same effect as the block__custom function, but you can be narrow it down to exactly when you want to include it. Like say you wanted to include the recent_offerings field and you want to apply a custom CSS class to it. You can just call the addHeadContent function. <br /><br />This is opposed to calling the block_custom function and added the css style there. You would then probably have to add a comment to beside the style sheet there just to remind yourself why this style sheet is even in there. <br /><br />So it's just for convenience sake.
Image (Empty)
Date posted Fri May 30 13:14:00 2008
Posted by noreply@blogger.com (Fong Chun Chan)
Status Approved
Categories Blog
Source id Fong's Blog
Source url http://fongxataface.blogspot.com/2008/05/how-to-add-custom-stylesheets-and.html
Powered by Xataface
(c) 2005-2023 All rights reserved