Get started with PHP-Fusion

jQuery & PF v7 - how to... part 3

Let see first example which is not W3C compatible. We will use PF v7 output handling functions (in second exaple, too). Create new panel, paste below code, save panel, enable it:


?>
add_to_head("<noscript><meta http-equiv='refresh' content='0,URL='js.html' /></noscript>");
<?php


Because this code will redirect us to new page (called js.html), we need to create and upload this too root of our site. From this moment every user which entering our site and hasn't JS enabled in browser will see this page. Example message in this page may look like below:


Sorry, but your browser doesn't support or has not enabled JavaScript. This page require JavaScript. If you're already enabled JavaScript click <a href='index.php'>HERE</a> to go back on main page.


And now example compatible with W3C but which need some theme modyfications. part of (or all of?) DIV based themes in PF v7 contain main DIV:


<div id='container'>[SITE]</div>


If users should have JS enabled then:
1) In styles.css file of your theme modify/add line to #container class:


display:none;


so if your theme not contain #container class add below lines:


#container {
display:none;
}


2) After #container DIV closing tag add next DIV with example text:


<div id='js'>
Sorry, but your browser doesn't support or has not enabled JavaScript. This page require JavaScript. If you're already enabled JavaScript click <a href='index.php'>HERE</a> to go back on main page.
</div>


Next we nedd to create new panel with code:


?>
add_to_head("
<script type='text/javascript'>
$(function(){
$("#js").css("display","none");
$("#container").css("display","block");
});
<script>
");
<?php


When user has no JS enabled then will se above message in other case will se our site content.

Next article soon ;)

PS: thanks to Pieka from Polish PF Support for article formatting.
Posted by Wooya on October 26 2009 16:12:58
1 Comment · 26551 Reads · Print
Comments
#1 | Grimloch on Dec 11 2011 at 14:44:05
Very good article as well as Part 1 & 2. I have no idea of course, what Pieka did as far as formatting this article (part 1 & 2 also); but it is not good. On all 3 parts I have to scroll my browser horizontally to read the entire article content. I would like to volunteer to fix these articles for you guys. I am a very good editor. If agreeable please let me know.
Cool
Post Comment
Please Login to Post a Comment.
Ratings
Rating is available to Members only.

Please login or register to vote.

No Ratings have been Posted.