Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder
    Join Date
    Mar 2009
    Posts
    175
    Thanks
    3
    Thanked 1 Time in 1 Post

    How can I set this to load on page load with delay?

    This script displays a link to a registration/login form that loads in a light box for Joomla.
    I've been goin nuts trying to figure out how to get this to load on page load with a delay.
    Anyone know how to get this done?
    PHP Code:
    <?php
    JHTML
    ::_('behavior.mootools');
    $document JFactory::getDocument();
    $document->addStyleSheet(JURI::base() . 'media/system/css/modal.css');
    $document->addScript(JURI::base() . 'media/system/js/modal.js');
    $document->addScriptDeclaration("window.addEvent('domready', function() {SqueezeBox.initialize({});});");
    $user = & JFactory::getUser();

    $uri JFactory::getURI();
    $url $uri->toString();
    $return base64_encode($url);

    ?>
    <div id="lbframeid" style="position:absolute;top:1px;left:1px;height:0px;width:0px;overflow:hidden">
    <a href="http://www.wowjoomla.com/"><h1>Joomla Login LightBox powered by WowJoomla.com</h1> </a>
    </div>
    <?php if ($user->get('guest')) :?>
       <a href="<?php echo JRoute::_('index.php?option=com_loginbox')?>
          onclick="SqueezeBox.fromElement(this); return false;"  
          rel="{handler: 'iframe', size: {x: 660, y: 500}}"><?php echo JText::_('SIGNUP_LOGIN')?></a>
       <?php else: ?>
    <?php 
    echo JText::sprintf'HINAME'$user->get('name') ); ?>
    <br>
       <a href="javascript:void(0);" onclick="LB_onLogout(); return false;"><?php echo JText::_('LOGOUT')?></a>
    <?php endif; ?>
    <script type="text/javascript">
    function LB_onLogout() {
       var form = new Element('form');
       form.setProperty('method', 'POST');
       form.setProperty('target', '_self');
       form.setProperty('action', 'index.php');
       
       var input = new Element('input');
       input.setProperty('type', 'hidden');
       input.setProperty('name', 'option');
       input.setProperty('value', 'com_user');
       form.appendChild(input);
       
       var input = new Element('input');
       input.setProperty('type', 'hidden');
       input.setProperty('name', 'task');
       input.setProperty('value', 'logout');
       form.appendChild(input);
       
       var input = new Element('input');
       input.setProperty('type', 'hidden');
       input.setProperty('name', 'return');
       input.setProperty('value', '<?php echo $return?>');
       form.appendChild(input);
       
       $E('body').appendChild(form);
       form.submit();
    }
    </script>

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    You want the entire page to delay? Use sleep($iNumSeconds) at the start to delay processing. If this isn't what your wanting, use JS to delay.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #3
    Regular Coder
    Join Date
    Mar 2009
    Posts
    175
    Thanks
    3
    Thanked 1 Time in 1 Post
    Thanks for the reply,

    Here's the dilemma..
    I tried using js to delay, but the problem is it always brings up the form in a full page instead of in the lightbox.

    I thought about adding a sleep() to the php script it's self, but I'm not real sure how to get it to trigger the action on page load instead of just displaying a link as it is now. I tried changing the onclick to onload but it doesn't work, I guess I need to maybe add some js to the header to get it to work that way?

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    If you are intending an onload delay, thats js. PHP can only delay processing, it does not care about anything that happens before or after the processing (such as events).
    Anything browser based (layouts, colour, events, etc) are all client side technologies, and are resolved with html, css, js, flash, etc. PHP can make the source, but it sounds like a JS issue to me.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #5
    Regular Coder
    Join Date
    Mar 2009
    Posts
    175
    Thanks
    3
    Thanked 1 Time in 1 Post
    Ok, so js is the way to go, which is the way I had originally tried, now I just need to figure out how to get the lightbox to trigger instead of just loading up a whole new window.

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    I'll move this to the JS forum.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #7
    Regular Coder
    Join Date
    Mar 2009
    Posts
    175
    Thanks
    3
    Thanked 1 Time in 1 Post
    Thanks.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •