Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

PHP includes and Dreamweaver

  • 12-04-2012 6:10pm
    #1
    Registered Users, Registered Users 2 Posts: 23,641 ✭✭✭✭


    Basic question

    I have an includes statement for a header and footer

    <?php include("header.php"); ?>

    <?php include("footer.php"); ?>

    I assumed that the header and footer would disappear, into a PHP script icon, from Design view, however I am now left with just the header. :confused:


Comments

  • Registered Users, Registered Users 2 Posts: 437 ✭✭t1mm


    You need to type code like that into the Code View in DW. If you type it in Design view, it will just reproduce the code as text instead.


  • Registered Users, Registered Users 2 Posts: 23,641 ✭✭✭✭Elmo


    t1mm wrote: »
    You need to type code like that into the Code View in DW. If you type it in Design view, it will just reproduce the code as text instead.

    Both statements are in the code.

    The design view is showing the php generated header (fully styled) and nothing else.


  • Registered Users, Registered Users 2 Posts: 437 ✭✭t1mm


    Are you running a server locally? A html page will open fine in a browser, but you need to be running a server with PHP installed for it work correctly. Generally the file also needs to be saved as .php rather than .html.

    If you haven't got a server installed, I'd recommend xampp:

    http://www.apachefriends.org/en/xampp.html


  • Registered Users, Registered Users 2 Posts: 23,641 ✭✭✭✭Elmo


    t1mm wrote: »
    Are you running a server locally? A html page will open fine in a browser, but you need to be running a server with PHP installed for it work correctly. Generally the file also needs to be saved as .php rather than .html.

    If you haven't got a server installed, I'd recommend xampp:

    http://www.apachefriends.org/en/xampp.html

    I have xampp installed but I am not running it at the moment.

    I am just talking about design view in Dreamweaver.

    I have placed an includes statement at the top of the PHP file, after the opening <body> tag.

    [PHP] <?php include("header.php"); ?>[/PHP]

    rather then the usual php icon as below

    phpdw6.jpg


  • Closed Accounts Posts: 2,663 ✭✭✭Cork24


    Elmo wrote: »
    t1mm wrote: »
    Are you running a server locally? A html page will open fine in a browser, but you need to be running a server with PHP installed for it work correctly. Generally the file also needs to be saved as .php rather than .html.

    If you haven't got a server installed, I'd recommend xampp:

    http://www.apachefriends.org/en/xampp.html

    I have xampp installed but I am not running it at the moment.

    I am just talking about design view in Dreamweaver.

    I have placed an includes statement at the top of the PHP file, after the opening <body> tag.

    [PHP] <?php include("header.php"); ?>[/PHP]

    rather then the usual php icon as below

    phpdw6.jpg


    For dream weaver to use php in design view u will still need xampp running and dream weaver will ask to to pick a web server local ad browser the the folder of it

    Once this is done you can program php in design view with dream weaver


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 23,641 ✭✭✭✭Elmo


    Cork24 wrote: »
    For dream weaver to use php in design view u will still need xampp running and dream weaver will ask to to pick a web server local ad browser the the folder of it

    Once this is done you can program php in design view with dream weaver

    Sorry, I don't want to see PHP running in Dreamweaver.

    The includes php files takes care of the header and footer.

    For some strange reason the header is showing up in dreamweaver, however the rest of the design view is blank, so I can't see any other content, except in code view.

    I think it is reacting for some strange reason to an unclosed div tag in the file :(


  • Moderators, Technology & Internet Moderators Posts: 11,017 Mod ✭✭✭✭yoyo


    Elmo wrote: »
    Sorry, I don't want to see PHP running in Dreamweaver.

    The includes php files takes care of the header and footer.

    For some strange reason the header is showing up in dreamweaver, however the rest of the design view is blank, so I can't see any other content, except in code view.

    Dreamweaver won't render the contents of header/footer.php at all, thats why it shows the PHP code block. As said above for header to show/render you would need to run the page through a webserver running PHP, Xampp in your case. If you have style data in the included files, these styles won't show in Dreamweaver. Could you post a code snippet of what your trying to do?

    Nick


  • Registered Users, Registered Users 2 Posts: 23,641 ✭✭✭✭Elmo


    yoyo wrote: »
    Dreamweaver won't render the contents of header/footer.php at all, thats why it shows the PHP code block. As said above for header to show/render you would need to run the page through a webserver running PHP, Xampp in your case. If you have style data in the included files, these styles won't show in Dreamweaver. Could you post a code snippet of what your trying to do?

    Nick

    Why is it is rendering it so? I don't want it to render. I just want the php icon at the top and the bottom design view. But for some reason every page that has the php includes code only provides a rendered header in design view. I do not have WampServer server running.

    The page is working fine otherwise

    [HTML]<body>
    <div id="wrapper">
    <?php include("header.php"); ?> <!-- header -->
    <div id="otherdivs"> content </div>
    <?php include("footer.php"); ?> <!-- footer -->

    <div>
    </body>[/HTML]


    header.php
    [HTML]<body>
    <div id="header">
    <div id="headerindent"> <a href="/index.php"><img src="/_images/img.png" alt="LOGO" class="floatleft" /></a>
    <div id="menu">
    <dl>
    <div>
    <dt class="btn"><a href="/link">link</a></dt>
    <dt class="btn"><a href="/link">link</a></dt>
    <dt class="btn"><a href="/link">link</a></dt>
    <dt class="btn"><a href="/link">link</a></dt>
    </div>
    <div class="break">
    <dt class="btn"><a href="/link">link</a></dt>
    <dt class="btn"><a href="/link">link</a>
    </dt>
    <dt class="btn"><a href="/link">link</a></dt>
    <dt class="btn"><a href="/link">Link</a></dt>
    <dt class="btn"><a href="/link">Link</a>
    </dt>
    <dt class="btn"><a href="/link">Link</a></dt>
    </div>
    </dl>
    </div>
    </div>
    </div>

    </body>[/HTML]


  • Registered Users, Registered Users 2 Posts: 23,641 ✭✭✭✭Elmo


    ?


  • Closed Accounts Posts: 2,663 ✭✭✭Cork24


    Even if you have HTML Code in Side your code at the end of the day you are saving the file as a PHP file.

    Dreamweaver see this a a php file and cant show anything in desgin veiw..

    I know what you are doing

    your taken all the

    <html>
    <title></title>
    <head>
    Css....JS....PHP....
    </head>
    inside the Header.php & the </body></html> inside the footer.php its faster and looks better coding.

    But since your saving all this HTML and php code inside a Index.php no matter what HTML JS coding you have dreamweaver wont read it so all you get is the 2 icons


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 23,641 ✭✭✭✭Elmo


    Cork24 wrote: »
    But since your saving all this HTML and php code inside a Index.php no matter what HTML JS coding you have dreamweaver wont read it so all you get is the 2 icons

    Arrrahhhh :D I am not getting the php icon, I want the php icons. All I get is the menu at the top of the design view, which is formatted by the css file. But I get none of the rest of the page. Just the HEADER MENU!


  • Closed Accounts Posts: 2,663 ✭✭✭Cork24


    Just run your Web-server and run it from their... like every one else does to see their page in design.


  • Registered Users, Registered Users 2 Posts: 9,579 ✭✭✭Webmonkey


    I think everyone is missing the point of what Elmo wants. Correct me if I'm wrong Elmo.

    - He does not want the PHP interpreted by WAMP and shown in design view.
    - He wants to just see normal HTML in the PHP file and any PHP code shown as place holders in design view.

    What is happening is, he's ending up with the contents of his header file shown in design view and this is not what he wants.

    I've no time to look now but might later on.

    By the way you have <body> tags in both header file in in the page it's included in. This should only exist once.


  • Registered Users, Registered Users 2 Posts: 23,641 ✭✭✭✭Elmo


    Webmonkey wrote: »
    By the way you have <body> tags in both header file in in the page it's included in. This should only exist once.

    I think this is my mistake.


  • Registered Users, Registered Users 2 Posts: 6,465 ✭✭✭MOH


    Elmo wrote: »
    I think this is my mistake.

    Also, just before the closing </body> tag you have <div>, which presumably should be </div> to close the wrapper div?


Advertisement