Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: PHP syntax and correct positioning

  1. #11
    Twayne
    Guest

    Default Re: PHP syntax and correct positioning

    In news:Adendum.4agu0b@no-mx.forums.netobjects.com,
    Adendum <Adendum.4agu0b@no-mx.forums.netobjects.com> typed:
    > Andrew,
    >
    > No apology needed Andrew - I know you are trying to help,
    > and it's appreciated
    >
    > The original client-drawings.php opens perfectly within
    > Firefox and IE8, so I know the page is OK but I made a
    > copy of client-drawings.php and stripped out everything.
    > Just left it like this:-
    >
    >
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01
    > Transitional//EN"> <html>
    > <head>
    > <title>Client-Drawings</title>
    > </head>
    > <body>
    > <h1>Drawings:-</h1>
    > <p style="margin-bottom: 0px;">Lorem ipsum dolor sit amet,
    > consectetuer adipiscing elit, ............ You can see the
    > original photographs from <a
    > href="../html/client-originals.php">here</a>.</p> </body>
    > </html>
    >
    > And it made no difference.
    >
    > I tried replacing the include with a simple echo statement
    > and my simple "Hello World" didn't display either. So could
    > it be something wrong in my XAMPP set up maybe?
    >
    > Hard to know what else to test - the pages seem OK, the
    > include syntax seems OK. Is there another way to get the
    > include into a NOF layout?
    >
    > [- Time for bed here in the UK, so I'll sleep on it and
    > look forward to checking back here in the morning. Thanks
    > again for your input- ]


    Turn ON error reporting so every error will produce a message.

    HTH,

    Twayne`

    >
    >
    > Paul - Aditerum & Adendum
    > NOF11 (in Admin mode!); Vista Premium 64bit; AMD Phenom
    > IIx4 945 Processor 3.00Ghz; 8.0Gb RAM





  2. #12
    Junior Member
    Join Date
    May 2010
    Posts
    1

    Default

    I tried replacing the include with a simple echo statement and my simple "Hello World" didn't display either. So could it be something wrong in my XAMPP set up maybe?
    This might seem awfully obvious but it sounds like you're using XAMPP for the first time.

    You are looking at http://localhost/yoursite and not the Local Publish folder aren't you?

  3. #13
    Senior Member Adendum's Avatar
    Join Date
    Apr 2010
    Location
    London (UK) & Granada (Spain)
    Posts
    926

    Default [ RESOLVED ] - PHP syntax and correct positioning

    Well, I am pleased but also embarrassed to say that the issue is resolved.

    There was nothing wrong with the syntax I was using, nothing wrong with how or where I was positioning the php include statements and there was absolutely nothing wrong with the XAMPP set up or .ini files.

    I totally forgot that I had a script buried in the included pages :-
    if
    (top.location.href!="http://www.domain.co.uk/index.html")
    {
    top.location.href= "http://www.domain.co.uk/index.html";
    }
    The script ensures that Google search results will take the browser to the main/surrounding page and not just the content page. I had the old html pages referenced when everything had been changed to php pages.

    @Technology Ideas : Apologies for wasting your time on this but I did learn quite a bit more about php in the process, so don't think your efforts were wasted. I can't thank you enough for taking the time, effort and trouble. Very much appreciated.

    @Twayne : Also many thanks for the extensive posts - also proved to be helpful in their own way. Incidentally "Did you include w3schools.net and/or php.net in those searches?" Yes I did and these were my starting point. So I 'knew' I probably had the correct syntax at the first attempt but the 'guessing' was really about lack of confidence (very new to php) and my usual concern about the 'subtleties' of NOF handling/structure....so I tried everything! And as far as XAMPP use - yes, I only run it when I am testing or experimenting with Joomla - and always STOP the services before exiting XAMPP.
    Paul - Aditerum Ltd and AllSortsOfStuff Ltd
    NOF11 (in Admin mode!); Vista Premium 64bit; AMD Phenom IIx4 945 Processor 3.00Ghz; 8.0Gb RAM
    Wouldn't it be great if there was only a single browser to worry about!!!

  4. #14
    Twayne
    Guest

    Default Re: PHP syntax and correct positioning

    In news:Adendum.4ajllb@no-mx.forums.netobjects.com,
    Adendum <Adendum.4ajllb@no-mx.forums.netobjects.com> typed:
    > Well, I am pleased but also embarrassed to say that the
    > issue is resolved.


    lol, well you won't be the last to say that, nor are you the first! The
    important thing is resolution, right?

    ....

    >
    > *@Twayne : *Also many thanks for the extensive posts - also
    > proved to be helpful in their own way. Incidentally -"Did
    > you include w3schools.net and/or php.net in those
    > searches?" -Yes I did and these were my starting point. So
    > I 'knew' I probably had the correct syntax at the first
    > attempt but the 'guessing' was really about lack of
    > confidence (very new to php) and my usual concern about the
    > 'subtleties' of NOF handling/structure....so I tried
    > everything! And as far as XAMPP use - yes, I only run it
    > when I am testing or experimenting with Joomla - and always
    > STOP the services before exiting XAMPP.
    >


    Sounds like you'll do fine with it; you have the savvy to get going with it
    I'd say. BTW, news.php.net has some great folks there; You'll probably like
    the place if you haven't already discovered it. They like examples of your
    work, just to prove you're not looking for a free ride but they're
    reasonable about it.


    HTH,

    Twayne`


    >
    > Paul - Aditerum & Adendum
    > NOF11 (in Admin mode!); Vista Premium 64bit; AMD Phenom
    > IIx4 945 Processor 3.00Ghz; 8.0Gb RAM





  5. #15
    Senior Member RayC's Avatar
    Join Date
    Apr 2010
    Location
    Toronto-ish, Canada
    Posts
    1,732

    Default

    Quote Originally Posted by Adendum View Post
    I totally forgot that I had a script buried in the included pages :-
    Paul, for the PHP Challenged among us, can you spell out a bit more clearly exactly what the issue was?

    Inquiring minds want to make a note...

    -RayC

  6. #16
    Senior Member chuckj's Avatar
    Join Date
    Jan 2010
    Location
    www.beyondfusion.com - Florida
    Posts
    1,302

    Default

    He forgot to change the URLs in the part of the script he referenced from .html to .php file extensions.

    PHP works really well..... whenever it doesn't, it's normally cockpit trouble with the programmer.

    I've spent more than a minute or two over the years fixing some type I made that was staring me in the face.

    It's the obvious that gets you nearly every time.
    Chuck Joslin
    www.BeyondFusion.com
    PHP & MySQL development with Fusion
    Fusion support for AllWebMenus (Likno) Contact me for custom AWM menus for your sites.
    Tutorials and Forums

  7. #17
    Member paby's Avatar
    Join Date
    Apr 2010
    Location
    germany - somewhere near munich
    Posts
    55

    Default

    my keyboard is out of order - i keep it short
    i do it like this - and it works on my pages

    <?php include "yourpage.whatever"; ?>
    include can be html/php/txt/inc and others

  8. #18
    Senior Member Adendum's Avatar
    Join Date
    Apr 2010
    Location
    London (UK) & Granada (Spain)
    Posts
    926

    Default

    Quote Originally Posted by RayC View Post
    Paul, for the PHP Challenged among us, can you spell out a bit more clearly exactly what the issue was?

    Inquiring minds want to make a note...

    -RayC
    Not much I can offer here really.

    In the end it seems my original syntax was OK
    ...
    <?php include('client-drawings.php'); ?>
    as was
    <?php include("client-drawings.php"); ?>
    as was
    <?php include 'client-drawings.php'; ?>

    The positioning within my NOF layout was OK too.

    And after much ado I established (with Andrew's help) that my XAMPP set up was OK as well.

    In the end I realised I simply had a script that referenced
    ...client-drawings.html buried inside the included .php page. So when I came to test the page in XAMPP the included page was telling the browser to use an html page that wasn't there any more...so all I saw was blank space.

    So not a PHP problem at all - just another PHP Challenged Dummy at my end !
    Paul - Aditerum Ltd and AllSortsOfStuff Ltd
    NOF11 (in Admin mode!); Vista Premium 64bit; AMD Phenom IIx4 945 Processor 3.00Ghz; 8.0Gb RAM
    Wouldn't it be great if there was only a single browser to worry about!!!

  9. #19
    Senior Member
    Join Date
    Apr 2010
    Posts
    352

    Default

    To be truly correct in php world (and pedantic about it), you should use
    <?php include 'client-drawings.php'; ?>
    which was one of your options. The other lines will work, but if you program in php and ever get more complicated, the other parts of the string are redundant and can also cause confusion with if the else type statements () and/or putting real text in "". Using single quotes instead of double quotes saves PHP from having to parse your string for variables. It not only is faster, but it is easier to find variables in your code.
    Last edited by Technology Ideas; 05-07-2010 at 01:15 AM.

  10. #20
    Senior Member Adendum's Avatar
    Join Date
    Apr 2010
    Location
    London (UK) & Granada (Spain)
    Posts
    926

    Default

    Andrew,

    Noted!

    I'm booking my flight to Melbourne for my .php course. Can I stay at your place?
    Paul - Aditerum Ltd and AllSortsOfStuff Ltd
    NOF11 (in Admin mode!); Vista Premium 64bit; AMD Phenom IIx4 945 Processor 3.00Ghz; 8.0Gb RAM
    Wouldn't it be great if there was only a single browser to worry about!!!

Posting Permissions

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