Jump to content
Larry Ullman's Book Forums

Search the Community

Showing results for tags 'modularizing'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Single Editions
    • Modern Javascript: Develop and Design
    • The Yii Book
    • Effortless Flex 4 Development
    • Building a Web Site with Ajax: Visual QuickProject
    • Ruby: Visual QuickStart Guide
    • C++ Programming: Visual QuickStart Guide
    • C Programming: Visual QuickStart Guide
    • Adobe AIR: Visual QuickPro Guide
  • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (5th Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (4th Edition)
    • PHP 6 and MySQL 5 for Dynamic Web Sites: Visual QuickPro Guide (3rd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (2nd Edition)
    • PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide (1st Edition)
  • PHP for the Web: Visual QuickStart Guide
    • PHP for the Web: Visual QuickStart Guide (5th Edition)
    • PHP for the Web: Visual QuickStart Guide (4th Edition)
    • PHP for the Web: Visual QuickStart Guide (3rd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (2nd Edition)
    • PHP for the World Wide Web: Visual QuickStart Guide (1st Edition)
  • Effortless E-commerce with PHP and MySQL
    • Effortless E-Commerce with PHP and MySQL (2nd Edition)
    • Effortless E-Commerce with PHP and MySQL
  • PHP Advanced: Visual QuickPro Guide
    • PHP Advanced and Object-Oriented Programming: Visual QuickPro Guide (3rd Edition)
    • PHP 5 Advanced: Visual QuickPro Guide (2nd Edition)
    • PHP Advanced: Visual QuickPro Guide
  • MySQL: Visual QuickStart Guide
    • MySQL: Visual QuickStart Guide (2nd Edition)
    • MySQL: Visual QuickStart Guide (1st Edition)
  • Other
    • Announcements
    • Newsletter, Blog, and Other Topics
    • Forum Issues
    • Social

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Found 1 result

  1. Hi, I wasn't sure whether to post this in this forum or the "Modern JavaScript" forum so apologies if I've got it wrong. I am trying to modularise a website that is already in production and works fine, but the modularisation approach in chapter 2 looks very appealing. In one part of the website I have the index.php 'controller' module which includes other modules on a one by one basis as needed. The structure of index.php is as per chapter 2 of the book. Every time the index.php module is invoked, I include header.inc.htm which has within it an invocation of a small JS routine which just adjusts the width of the displayed website based on the width of the available viewport. What happens is that the first time index.php includes say module_a.php the width adjustment works perfectly. Then after having done its thing, module_a.php calls module_b.php via the index.php controller passing it a parameter that module_b needs. However, even though the exact same header.inc.htm module gets included when module_b.php is included by index.php, the JS routine does not fire and the width of the website display does not get adjusted. I've attached some of the code; first the header.inc.htm file which invokes the JS adjust-wrapper_size() routine. As you can see, I tried both 'document ready' and window load' but the problem appears both ways. <!DOCTYPE html> <head> <title><?php echo $page_title; ?></title> <link rel="stylesheet" type="text/css" href="./css/the_css_file.css" media="screen" /> <script type="text/javascript" src="../jQuery/jquery_1.5.2.min.js"></script> <script type="text/javascript" src="../js/the_js_file.js"></script> <script type="text/JavaScript"> // window.onload(function() $(document).ready(function() { adjust_wrapper_size(); // to stop it from being too big! }); // end document ready function $(window).resize(function() { adjust_wrapper_size(); // to stop it from being too big! }); // end window resize function </script> </head> Now the code in module_a which calls module_b (add_cv_2) via index.php; .... $group_name = urlencode($_POST['cv_group']); $url = BASE_URL . "index.php?p=add_cv_2&cvgroup=$group_name"; if (!headers_sent($filename, $linenum)) { header("Location: $url"); exit(); } ...... Now the code within index.php... ..... case 'add_cv_2': $page = 'module_b.php'; $page_title = "The appropriate title"; break; ..... And finally the JS routine: function adjust_wrapper_size() { var s_w = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth || document.width; // to cater for all browsers // alert('Window/Screen width = ' + s_w); if (s_w > 1000) { $('#wrapper').css('width', 1000); } else { // screen < 1000 - use available screen $('#wrapper').css('width', s_w); } } My environment is: . Windows 7 Home Premium 64 bit . Internet Explorer 10 . Firefox 22.0 . Dreamweaver CS5 as the text editor . Flex 4 via FlashBuilder 4 . XAMPP for Windows 1.8.3 which comprises: .. Apache 2.4.4 .. PHP 5.5.3 .. MySQL 5.6.11 .. phpMyAdmin 4.0.4 Any assistance will be most appreciated. Thanks, and Cheers from Oz.
×
×
  • Create New...