Print Reseller Scheme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

PHP Confused

Discussion in 'Website Design Forum:' started by Alex B, Oct 31, 2011.

  1. Alex B

    Alex B Member

    Hi, new to the boards, I've done a few website and ok at coding them, I use notebook alot and then dreamweaver if I get stuck.....I'm stuck bigtime.

    I found the code for the footer/header using PHP script, fantastic I thought but it doesn't seem to work. I understand it is a server language and can't be viewed without being online.

    I have made a footer.PHP file just so I can get used to it, looks straight forward...
    ________
    <div id="footer-bg">

    <div id="footer-menu">

    <ul class="footMenu">

    <li class="noDivider"><a href="../index.html" title="Home">Home</a></li>
    <li><a href="../Galleries/WeddingRoot.html" title="WeddingAbout">Wedding</a></li>
    <li><a href="../Galleries/Celebration1.html" title="Celebration">Celebration</a></li>
    <li><a href="../Galleries/Christening1.html" title="Christening">Christening</a></li>
    <li><a href="../Galleries/Corporate1.html" title="Corporate">Corporate</a></li>
    <li><a href="../Pages/Ordering.html" title="Ordering">Ordering</a></li>
    <li><a href="../Pages/Contact.html" title="Contact">Contact</a></li>

    </ul>

    <br class="spacer" />

    <li class="copyright">Copyright &copy; Scrumptious Cakes 2000 - 2011 All Rights Reserved</li>
    <li class="copyright">Website designed by Scrumptious Cakes</li>

    </div>

    </div>
    _______
    ...and inserted the script onto webpage...

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

    I have tried to changing it every way I can, ie.....

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

    ..but still no joy. PHP header/footer would really change the way I write websites, and the application is endless.

    my website is Scrumptious Cakes Delivering to Dundee/Angus/Tayside/Fife/Perthshire in Scotland.

    I hope someone can help. Thank you for looking. :D Alex
     
  2. I would look at remaking the site in Wordpress instead as it would be a lot easier for you to set up the header and footer .php files :) but thats just me :)
     
  3. mrp2049

    mrp2049 Senior Member

    Concrete5 header and footer php is pretty good too.
     
  4. Alex B

    Alex B Member

    Thanks for the reply guys, Wordpress I have heard of, Concrete5 never (sorry). Tried to download Wordpress, not working properly, I think it is because I am using firefox. Concrete5 I will have to investigate cos I just haven't a clue. :)
     
  5. The wordpress should be working properly straight out the door, have you set up the mySQL database etc. If you show us the URL for the wordpress version we might be able to fix it :)
     
  6. Alex B

    Alex B Member

    WordPress (Version 3.2.1) from WordPress › Download , downloaded ok, extracted ok, just can't get much further. :( Tried to open the install.php but firefox doesn't like it and keeps popping up the "View and track your downloads" page. aagh. Sorry anger moment over, happy faces again :)
     
  7. Alex B

    Alex B Member

    Have I got to download a DesktopServer, cos this is a bit confusing, sorry, I am sure this is crystal clear to other but I have never looked into this before. :confused:
     
  8. No.... do the following to get Wordpress to work:

    1. Download Wordpress.
    2. Create a MySQL Database in your cPanel and a user with full privileges to do everything.
    3. Change the name of the file called wp-config-sample.php to wp-config.php open it in notepad++ or coding equivalent on MacOSX. There will be a section with the following code:

    Code:
    // ** MySQL settings - You can get this info from your web host ** ///** The name of the database for WordPress */define('DB_NAME', '[B][COLOR="Red"]database_name[/COLOR][/B]');/** MySQL database username */define('DB_USER', '[B][COLOR="red"]database_username[/COLOR][/B]');/** MySQL database password */define('DB_PASSWORD', '[B][COLOR="red"]password[/COLOR][/B]');
    put the relevant information into the areas marked database_name, database_username and password from creating your MySQL database (the parts marked bold and in red).

    4. Upload all files to the FTP server in the desired location. Once this is done go to the location in Firefox or any other browser. This will bring up the Install Wordpress page, as long as the information on your MySQL details above are correct. If it comes up with an error, it will mean that the information is wrong.

    5. Once the information is correct you can start to play with the design which will be located under wp-content/themes/
     
  9. If all else fails then you could ask nicely on the forum and someone may do the install for you :)
     
  10. Alex B

    Alex B Member

    Thanks for all the info!!!!! I have checked the cp and it says I have to order, do I need to pay extra to my host company for this privilege or is it free? I am with streamline.net.
     
  11. apparently you just have to create a MySQL database.. though it depends on the package I guess.

    Streamline.net Support

    from what I can see you can only have a MySQL database with the Plus Package for £3.49 per month.

    How long have you had the hosting for? As thats a pretty awful deal.
     
  12. Alex B

    Alex B Member

    Renewed it recently, unfortunately. Wifes site and was overdue so just paid it £3.00/mth inc Vat about. I have noticed that I have to have the PLUS account to have a MySQL database. Do I need the database, or is it ok without, oh by the way I am starting to feel a little out my depth now!
     
  13. For any CMS based website (Wordpress or otherwise) you'll need a MySQL database to run it from, as thats where it stores all the data etc.

    I'll wait for someone else to come into the thread who may know why your header.php and footer.php aren't working. Without all the files it may be difficult to see what you are doing wrong.
     
  14. For any CMS based website (Wordpress or otherwise) you'll need a MySQL database to run it from, as thats where it stores all the data etc.

    I'll wait for someone else to come into the thread who may know why your header.php and footer.php aren't working. Without all the files it may be difficult to see what you are doing wrong.
     
  15. Alex B

    Alex B Member

    I think I must be out of luck cos if I have to upgrade my website for the database it will not be worth it. I would really like to do it but for the extra cost I can't justify it, well not right now. So Sad :(
     
  16. well there are free MySQL database sites out there.. but they are slow.. I've used them in the past when a hosting company doesn't give MySQL as standard.. But if you have no options, you have not options :)
     
  17. Alex B

    Alex B Member

    Thanks for all your help on this matter Chris. I will look on google for these free sites. If as you say they are very slow I may just stick to html instead of php. Thanks again. Alex
     
  18. Jazajay

    Jazajay Active Member

    @Alex B
    Hi Alex just encase you want to learn PHP the answer to your question why is it not working is either one of 3 things, or all 3.

    First off to view PHP files offline, or even online but with out a webserver, you need a testing server. XAMPP will do you, free and pretty easy to setup.
    This will put the PHP files together for you.

    Secondly the file that is calling it needs to be PHP file and not html or any other extention.

    Thirdly where is the file you are referancing?
    If your root directly looks like this:

    index.php
    inc (Folder) -> footer.php

    Then in index.php you need to write:

    <?php require_once("inc/footer.php");?>

    <?php include("inc/footer.php")?>

    Would work, but you only need to bring it in once so require_once is the better function.

    Now open source CMS's, like Wordpress, well yeah the open source CMS bit nar not for me and why you should learn it yourself. Open source CMS's are built for the lowest comon web developer as the more people who can pick it up and code for it the more websites it will be placed on.

    We had a tender come through the other day at work (company work) saying they required an Open source CMS that had in depth web security. Yeah, just no one or the other, but most people don't think of it like that, or tend to care...Over 10k websites get hacked a week. I wonder why? :confused:
     
  19. Alex B

    Alex B Member

    JazaJay, thanks for the reply, I think my website look ok but some of the coding is poor, I sometimes use tables, I know, but it works. I was told by Chris I needed a MySQL database and the server I am on is charging me more to upgrade and I am reluctant to do that at the moment. That is why I asked about html headers/footers, I thought it was a bad idea. I am ok with the basis's but some of this is well over my head. (sssh but I don't even know what a MySQL database is!)

    Anyway I digress, if it can be done without a database or SOMETHING I would be very grateful!!
     
  20. Jazajay

    Jazajay Active Member

    Hay fella.
    You only need a MySQL Database if the content is dynamic and stored in a database. If the page is a static page, meaning the file doesn't need to create pages on the fly and all the content is stored within the pages it wont need a database. Includes do not require databases.

    Here try this.

    index.php

    <?php require_once("inc/header.php");?>

    <table>
    Home page content in here
    </table>

    <?php require_once("inc/footer.php");?>


    header.php
    (In a directory called inc off the root directory,)

    <html>
    <head>
    ...
    </head>
    <body>
    <p>
    <img src="" alt="[Logo]" />
    </p>
    <ul>
    <li><a href="">Nav1</a></li>
    <li><a href="about-us.php">Nav 2...</a></li>
    </ul>


    Footer.php

    (In a directory called inc off the root directory,)

    <ul>
    <li><a href="">Footer nav1</li>
    <li><a href="about-us.php">Footer nav 2...</a></li>
    </ul>
    </body>
    </html>


    About-us.php

    <?php require_once("inc/header.php");?>
    <table>
    About us page content in here
    </table>

    <?php require_once("inc/footer.php");?>


    Directory structure:

    index.php
    about-us.php

    (Inc) [Folder] -
    - Header.php
    - Footer.php


    Jobs a goodun and with no database in sight.
    If that doesn't work it will be down to either you viewing it locally via split view on some HTML software, or the Sever your are using is not configured to compile PHP files.

    If you let me know the error code you get I can help you out more. :)

    Key:
    Red - PHP
    Purple - HTML
     

Share This Page