Welcome to WebDesignForums.net!
You're currently viewing WDF as a guest. By registering for a free account, you'll be able to participate with other members in our friendly community. Being a member allows you to ask questions and get answers for those troublesome web development tasks!

In addition, as a member you'll be able to post your websites up for review. Using our unique website review system you can gain some amazing feedback from some of the best web developers around. This is a completely free service to all registered members.

Ready to register yet? Registration is 100% free. Click Here To Join Now!

U-include help PLZ!!!

Discussion in 'PHP' started by acegreen, Mar 18, 2012.

  1. Offline

    acegreen Member

    Message Count:
    31
    Likes Received:
    0
    Trophy Points:
    6
    Hi there! I'm pretty much a novice web design, lol. Naturally I'm having a lot of trouble with frontpage's include webbot (aka U-include). I'm not sure if I'm understanding it right.

    I'm under the impression that I can use U-include to create a portion of my site once and then just attach the portion (say, top.html, onto all my pages. When I want to change this portion up, I go to the original U-Include file (top.html), make the changes there and have the changes show up on every page that carries the U-include webbot. In theory.

    The problem is that, each and every time, the U-include bots are changing into HTML text!!! So it's defeating their purpose. What am I doing wrong? It's driving me crazy! Please help.

    Thanks in advance!!!

    AG


  2. Offline

    Webzarus Well-Known Member

    Message Count:
    3,005
    Likes Received:
    668
    Trophy Points:
    113
    Gender:
    Male
    Sorry to say, but that is a fault with frontpage... I believe your hosting provider has to have frontpage extensions installed and enabled for those to work... I'll have to check but I don't think I even have frontpage extensions as an option on my servers...

    That being said... Simple includes using asp, asp.net or php are a better option all around.

    They just display your code as you write it... Frontpage always had a bad habit of re-writing code it didn't like...


  3. Offline

    acegreen Member

    Message Count:
    31
    Likes Received:
    0
    Trophy Points:
    6
    Thanks for the reply and sorry for my late response. How would I set up an php include? Should I create a normal html include file (i only have frontpage - hope to get dreamweaver soon) and then copy/paste onto a txt editor where I can save the file with a php extension? Or is there a simpler/direct way?

    Any thoughts are welcomed! Thanks, again.


  4. Offline

    m3n0tu18 WDF Moderator and Drupalite!

    Message Count:
    1,374
    Likes Received:
    248
    Trophy Points:
    63
    Gender:
    Male
    Location:
    New York
    Moved to correct Forum :) -m3


  5. Online

    mlseim WDF Staff

    Message Count:
    5,484
    Likes Received:
    224
    Trophy Points:
    63
    Gender:
    Male
    Location:
    Cottage Grove, Minnesota
    @acegreen

    To use PHP, you need to change your file extension from .html to .php

    So, your main page would be "index.php"

    Once you do that, you can include any file you choose.

    Put this where it should appear ...

    <?php include("top.html");?>

    But you may want to also change "top.html" to "top.php",
    because within top.php you might be using some PHP scripting.

    So ...

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

    ================================

    Frontpage? Not much I can say about that. You're basically screwed.
    You'll never accomplish what you think should happen. It's horrible.
    Good luck.


    m3n0tu18 likes this.
  6. Offline

    Webzarus Well-Known Member

    Message Count:
    3,005
    Likes Received:
    668
    Trophy Points:
    113
    Gender:
    Male
    Yup, pretty much what he said...

    I don't know if frontpage will let you do most of this stuff without trying to re-write everything for you...


  7. Offline

    acegreen Member

    Message Count:
    31
    Likes Received:
    0
    Trophy Points:
    6
    Meant to reply sooner...but didn't get a chance. I understand if my make my main pages into php I can then include any file (html, php, js, etc). But I have a question as far as the php include code. Is there any benefit to going with
    <?php include("top.php");?> as opposed to <?php include("top.html");?> ???

    In other words: is there any benefit for the included file to also be php? Since I'm still using mainly Frontpage (then copy/pasting the code to my web hosting text editor to save in .php) saving inlcudes in .html lets me simply upload the includes rather than copy/paste them as well. But am I losing out in some other way by not using the same extension as often as possibly (uniformity reasons, etc.)

    Many thanks in advance,

    AG


  8. Offline

    Webzarus Well-Known Member

    Message Count:
    3,005
    Likes Received:
    668
    Trophy Points:
    113
    Gender:
    Male
    Actually, either will work pretty much the same as once it include is called... The php processor is running, even if you have some php scripting written in the .html file... It will be processed.

    From a troubleshooting aspect it's always best to name he file with whatever extension of the scripting language you're using... In this case, 6 months down the road, you decide you need to add a small piece of php code to the header.html file... It will actually work, but if you tried to call th file by itself ( manually ), it won't execute the .php code in it...

    Naming all your includes the same (.php in your case ), is just good practice.


Share This Page