Announcement

Collapse
No announcement yet.

PHP parse problems when logged in

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    PHP parse problems when logged in

    [FONT="Verdana"]Domain: www.gprsmodems.co.uk

    Actinic V10.

    Apologies I know this topic has come once before with some suggestions at this link:

    http://community.sellerdeck.com/printthread.php?t=53002

    I have PHP scripts running, one under "Contact & Social Media" and also "Blog". They work fine when not logged in. I realise it is to do with perl script running, when logged in for example. I have tried the suggestions in the earlier post, one using <script type="text/javascript" src="Blog.php" ></script> that returns the output in Javascript code. In the case of the Java workaround I made no progress, no difference in other words. The second workaround was using iframes. The new window was embedded withing the main page or window and could not find a solution to open a new window.

    I would be very gratefull for any suggestions

    Test log-in "test", password "14396"

    Kind regards

    John

    #2
    Originally posted by james233 View Post
    [FONT="Verdana"]Domain: www.gprsmodems.co.uk

    Actinic V10.

    Apologies I know this topic has come once before with some suggestions at this link:

    http://community.sellerdeck.com/printthread.php?t=53002

    I have PHP scripts running, one under "Contact & Social Media" and also "Blog". They work fine when not logged in. I realise it is to do with perl script running, when logged in for example. I have tried the suggestions in the earlier post, one using <script type="text/javascript" src="Blog.php" ></script> that returns the output in Javascript code. In the case of the Java workaround I made no progress, no difference in other words. The second workaround was using iframes. The new window was embedded withing the main page or window and could not find a solution to open a new window.

    I would be very gratefull for any suggestions

    Test log-in "test", password "14396"

    Kind regards

    John
    One solution to this kind of problem is to use javascript to load the php script into the page once the page has been written by the perl script thus preventing the perl script from reading in the php file and dumping the code onto the screen. That would work for logged on and logged off.

    looking at the menu link to the blog page this is a direct call to a page written in php,
    Code:
     <a class="product_section" href="acatalog/Blog.php">Blog</a>
    When you log on this link changes
    Code:
     <a class="product_section" href="http://www.gprsmodems.co.uk/cgi-bin/bb000001.pl?ACTINIC_REFERRER=http://www.gprsmodems.co.uk/cgi-bin/bb000001.pl&PRODUCTPAGE=Blog.php">Blog</a>
    using a perl script hence the problems for a logged on user.

    you will need to revert to a normal html page at which point the previous hacks given in your post should then work.

    Malcolm

    SellerDeck Accredited Partner,
    SellerDeck 2016 Extensions, and
    Custom Packages

    Comment


      #3
      Thanks Malcolm I will have a look tomorrow. Heres hoping!

      Comment


        #4
        Originally posted by malbro View Post
        One solution to this kind of problem is to use javascript to load the php script into the page once the page has been written by the perl script thus preventing the perl script from reading in the php file and dumping the code onto the screen. That would work for logged on and logged off.

        looking at the menu link to the blog page this is a direct call to a page written in php,
        Code:
         <a class="product_section" href="acatalog/Blog.php">Blog</a>
        When you log on this link changes
        Code:
         <a class="product_section" href="http://www.gprsmodems.co.uk/cgi-bin/bb000001.pl?ACTINIC_REFERRER=http://www.gprsmodems.co.uk/cgi-bin/bb000001.pl&PRODUCTPAGE=Blog.php">Blog</a>
        using a perl script hence the problems for a logged on user.

        you will need to revert to a normal html page at which point the previous hacks given in your post should then work.
        Hi Malcolm

        I changed the file to "Blog.html" and put the string '<script type="text/javascript" src="Blog.html" ></script>' into the related layout (outer layout for silver). This was placed just inside the <head> tag. Still not parsing. Would you mind having a look?
        Kind regards
        John

        Comment


          #5
          Originally posted by james233 View Post
          Hi Malcolm

          I changed the file to "Blog.html" and put the string '<script type="text/javascript" src="Blog.html" ></script>' into the related layout (outer layout for silver). This was placed just inside the <head> tag. Still not parsing. Would you mind having a look?
          Kind regards
          John
          I am afraid that will not work, you cannot use an html file in a script, you need to have an html page to hold the page information and a php file to introduce just the form into the page. the line

          Code:
          <script type="text/javascript" src="Blog.phpl" ></script>
          needs to be placed into the page where you want the form to be displayed not in the header.

          Malcolm

          SellerDeck Accredited Partner,
          SellerDeck 2016 Extensions, and
          Custom Packages

          Comment


            #6
            The way I would do this would be to use the jQuery libray and use a script to load the php

            in theheader
            Code:
            <script language="javascript" type="text/javascript" src="jquery.min.js"></script>
            in the main body at the correct position
            Code:
                   <div id="MyForm"> </div>
            	<script language="javascript" type="text/javascript">
            		<!--
            		function display_form(){
            			var postmsg = "blog.php";
            			$('#MyForm').load(postmsg,function(){});
            			return false;
            		}
            		$(document).ready(
            			function(){
            				display_form();
            			}
            		);					
            		//-->                                                                          
            	</script>
            This uses jQuery library to simplify the code, when page is loaded the script calls the function display_form() which first checks for an element with the id of MyForm, if no element exists nothing further happens. If it finds an element, in this case a <div> it then calls the host server using the contents of the variable postmsg as the name of the file to load. The php code should output the necessary html to produce the form, which is written to the div by jQuery, on completion it calls the function() which can contain additional javascript. The return false; ensure the page takes no further action.

            For this specific example you can simplify this function down to
            Code:
             
            		function display_form(){
            			$('#MyForm').load("blog.php");
            			return false;
            		}
            More documentation on the load function is found here http://api.jquery.com/load/

            This will not be affected by the perl scripts being used and will apear on the screen once the page is loaded.

            As you already have the jquery library in your code you can modify the existing call to the ready function to include this into the code for your slide show, use blockif's to prevent the code appearing on any other page.

            Code:
            <script type="text/javascript">
            
            //put the function display_form inside a blockif here
            
            $(document).ready(function(){
                $('.slideshow').innerfade( {
                    speed: 1000,
                    timeout: 10000,
                    type: 'sequence',
                    containerheight: '175px'
                });//end of innerfade
            
                // put the extra code inside a blockif  here 
            
            });//end of jquery
            </script>
            This is just an example of the technique and I have not actually tested this specific code but used similar techniques in the past to load interactive calendars into a page. It is easy to compact this code down into less lines but then it becomes much more difficult to understand the operation.
            Last edited by malbro; 04-Dec-2013, 12:07 PM. Reason: added more explanation

            Malcolm

            SellerDeck Accredited Partner,
            SellerDeck 2016 Extensions, and
            Custom Packages

            Comment


              #7
              Thanks Malcolm will try it later.

              Comment


                #8
                Malcolm thanks for your suggestions. I will try the jQuery approach when I have more time to study same. In the meantime I tried the "document.write approach. It now works to some extent on log-in. I have had problems trying to parse PHP when using document .write. I put the "Blogs.php" on the server and at present am just echoing thedate,title and read more. I am trying to change the font to blue on the title, but again having problems with parse errors etc. I thought you could use for example <font color="blue"> using the correct escape sequences. Below is the Blogs.php file. Would you mind checking and advising? Very much appreciated.
                Regards John

                -------------------------------------------------------------------------------


                <?php require('../wp/wp-blog-header.php'); ?>
                <?php $posts = get_posts('numberposts=10&order=ASC&orderby=post_title'); foreach ($posts as $post) : setup_postdata( $post );?>
                <?php echo "document.write (\""; the_date(); echo "<br />"; echo "\");\n";?>
                <?php echo "document.write (\""; the_title(); echo "<br />"; echo "\");\n";?>
                <?php //echo "document.write(\""; the_excerpt(); echo "<br />"; echo "\");\n";?>
                <?php //echo "document.write('<A HREF=\"http://www.gprsmodems.co.uk/cgi-bin/bb000001.pl?ACTINIC_REFERRER=http://www.gprsmodems.co.uk/cgi-bin/bb000001.pl&PRODUCTPAGE=\""?>
                <?php echo "document.write('<A HREF=\""?>
                <?php echo get_permalink(); ?>
                <?php echo "\"> Read More...</a>"; echo "<br />"; echo "<br />"; echo "');\n";?>
                <?php endforeach;?>

                Comment

                Working...
                X