Jump to content

lastkarrde

Members
  • Posts

    165
  • Joined

  • Last visited

    Never

Posts posted by lastkarrde

  1. This is amazing thanks. I will test it now. Meanwhile, do you mind explaining this to me? I don't mean to be a bother but I am extremely interested in understanding this.

     

    Sure. Because there is no "real" form submitting going on here the input elements could just as well be buttons or anchors. You can remove all the form markup.

     

    The jQuery (Javascript) listens to all click events on all elements that have the class approval (in this case its those input elements). When one is clicked, we extract the value attribute (Deny Contact Info[1,2,3,4]) and then call the window.open function with that value passed in the URL.

     

    $(document).ready(function(){
    
    $(".approval").click(function(){
    
    v = $(this).attr("value");
    url = 'deny_approval.php?section=' + v;
    
    window.open(url, "myWindow", 
    "status = 1, toolbar = no, scrollbars = yes, location = no, resizable = no, height = 600, width = 600, resizable = 0" );
    
    });
    
    });

  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <script src="js/jquery-1.5.js" type="text/javascript"></script>
    
    <script type="text/javascript">
    
    $(document).ready(function(){
    
    $(".approval").click(function(){
    
    v = $(this).attr("value");
    url = 'deny_approval.php?section=' + v;
    
    window.open(url, "myWindow", 
    "status = 1, toolbar = no, scrollbars = yes, location = no, resizable = no, height = 600, width = 600, resizable = 0" );
    
    });
    
    });
    
    
    
    
    </script>
    
    </head>
    
    <body>
    <form action="" method="post" enctype="multipart/form-data">
    
    <input class="approval" type="button"  value="Deny Contact Info1" /><br /><br />
    <input class="approval" type="button" value="Deny Contact Info2" /><br /><br />
    <input class="approval"  type="button" value="Deny Contact Info3" /><br /><br />
    <input class="approval" type="button"  value="Deny Contact Info4" /><br /><br />
    
    </form>

  3. I only ever use Twig nowadays. Its a full featured templating language with a very basic syntax that only takes 5 minutes to learn. It has template inheritance which makes things like what your trying to do a breeze. For example you would just define a basic template with many blocks like :

     

    base.html

    <html>
    <head>
    <title>{% block title %}{% endblock %}</title>
    </head>
    
    <!-- define menu/sitewide features here -->
    
    {% block content %}{% endblock %}
    
    <!--  define footer/sidewide features here -->
    
    </html>
    

     

    All you would need to do to render any page on your website is:

    aboutus.html

    {% extends 'base.html %}
    {% block title %}About Us{% endblock %}
    {% block content %} About us content blah blah {% endblock %}
    

     

    Twig automatically (and somewhat magically) takes your about page and replaces the appropriate blocks into the base.html template. It then compiles all of this into straight PHP and caches the PHP code. So when you enable caching (a Twig configuration setting), it will render the straight PHP code making it as fast (if not faster) than a PHP templating solution.

     

    Useful links:

    Twig syntax & features

    Twig PHP API

  4. The 'headers already sent' error message is basically telling you that your server has already started sending the HTML/css data in header.php to the client, and then your trying to send the header() redirect to the client.

     

    Why do you need to display HTML/css on a page that simply redirects? The user wouldn't see anything on that page anyway, would they?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.