Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Jul 2005
    Location
    Mumbai, India.
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Include page help

    I am developing site where i need to call external file. I have 100 pages to make, in all pages left bar and right bar is the same, but it can be change later on. I know we can make 2 differant files and can call it in main file, i tried to use jsp, but i dont know some how its not showing any of external file. Please help me and tell me which is the best way to call external file. and code for it.

    its urgent.

    Sudhir

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    This depends on the format for your pages.
    Personally, I generate links using mysql for pages that can be dynamic, depending on the backend for the site. If its smaller, I validate using arrays. For larger number of pages such as yours, you would probably want to go with the inclusion you are suggesting.
    Now, I'm just not certain what your structure is like, and how your generating information from it.
    Is what you are looking for, being able to build each link by selecting the names from the filesystem? Or do you have a specific file/method in which you contain these file names? Let us know how you have/plan on getting the names for the pages in the first place, that will tell us what method to look at doing.

  • #3
    Senior Coder
    Join Date
    Feb 2003
    Posts
    1,665
    Thanks
    0
    Thanked 27 Times in 25 Posts
    Some info about PHP Includes…

    PHP online manual: include() function
    W3Schools.com : PHP Include Files (SSI)
    Including Content - A Review
    Part III - Creating Templates with Include Pages

    Google : php includes introduction

    (PHP Includes aren't complex and are easy to implement. The above links all say roughly the same thing, but one will have a voice that suits you best and helps you get to grips with the basics.)

  • #4
    New to the CF scene
    Join Date
    Jul 2005
    Location
    Mumbai, India.
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow code which i am using

    Hi Thanks for your reply. here is the code which i am using for my files.

    index.php file where i want to call external file.

    <%@ page contentType="text/html; charset=" language="java" import="java.sql.*" errorPage="" %>
    <jsp:useBean id="db" scope="page" class="mysql.Connect" />

    <html>
    <HEAD>
    <title>Association of Medical Technologists (WI)</title>
    <META NAME="DESCRIPTION" CONTENT="AMT">

    <!-- Metadata generated by http://www.mahatma.org.in -->
    </HEAD>


    <body bgcolor="#FFFFFF" vlink="#000000" link="#000000 text="#000000" topmargin=1 leftmargin=1 marginheight=1 marginwidth=1>


    <table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr><td valign="top" align="left"><jsp:include page="topbar.jsp" flush="true" /></td></tr>
    <tr>
    <td height="411" align="left" valign="top">
    <table border=0 cellpadding=0 cellspacing=2>
    <tr>
    <td width="159" valign=top>
    <%@ include page="leftbar.jsp"%></td>
    <td width="570" valign=top>
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
    <tr>......
    there is more code. but i think from this you can understand, what i am looking for.

    and this is leftbar.jsp file which i want to include in index.php

    leftbar.jsp
    <table border="0" width="100%" cellspacing="0" cellpadding="0">
    <tr>
    <th width="100%" align="left" valign="top" bgcolor="#23397F"><p align="center"><strong><font color="#FFFF00" size="2" face="Verdana, Arial, Helvetica, sans-serif">e-Books<br>
    </font></strong><img src="images/left-bttn-bar4.gif" width="159"><br>
    <object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="160" height="130">
    <param name="movie" value="images/slide.swf">
    <param name="quality" value="high">
    <embed src="images/slide.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="160" height="130"></embed></object>
    </p>
    </th>
    </tr>
    </table>

    Please see this and let me know whats wrong in it. or i should php for it? But i dont know how to include files in php. Please guide me.

    Thanks,
    Sudhir
    Last edited by sudhirrr; 07-13-2005 at 02:06 PM.

  • #5
    New to the CF scene
    Join Date
    Jul 2005
    Location
    Mumbai, India.
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb waiting for reply

    hey guys/ gals,

    i am waiting for reply. pls help me in it.


    sudhir

  • #6
    Senior Coder
    Join Date
    Jul 2005
    Location
    UK
    Posts
    1,051
    Thanks
    6
    Thanked 13 Times in 13 Posts
    Did you even read those links posted for you? .php includes are the best way to do this.

  • #7
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    ASP:
    Code:
    <%@ include page="leftbar.jsp"%>
    PHP
    PHP Code:
    <?php include('./leftbar.jsp');?>
    Or with ASP style identifiers:
    PHP Code:
    <% include('./leftbar.jsp');%> 
    Please note, I wouldn't recommend using those, as they may be off on a using server. As well, you cannot combine ASP and PHP together within one script, it will be processed as one or the other.
    I had been mistaken as well as to what you mean, I thought you were asking how to create the links using php, not how to include them.

    Another option as well is a virtual() function, though with your ASP, I'm going to say your virtual() function will not work.

  • #8
    New to the CF scene
    Join Date
    Jul 2005
    Location
    Mumbai, India.
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question codes needed

    I'll tell you know what i need exactly. I have to develope site of 100 pages, on each page i have common content that is on left side, which i am calling as leftbar. now what i want i want to make 1 file call leftbar which will include in all pages dynamicaly. So if there is any changes in leftbari will have to change only leftbar so it will be automatically change in all pages.

    Now you tell me what should i use as i will upload it on linux server. I cant use asp. php and jsp i can use but i dont know how it will work, as in jsp i tried adding this line of code
    Code:
    <jsp:include page="leftbar.jsp" flush="true">
    </jsp:include>
    But i dont know why its not showing.

    Please help.

    Sudhir

  • #9
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Unfortunatly, I'm not familiar with jsp or how it works, so I can't give you any advice there. However, if you mean the page is a jsp page, don't be concerned, you can include that as it should be parsed ahead of time (jsp is server side right, lol).
    Using a *nix server leaves you quite a few opportunities to use. Apache can use SSI, which, now its been awhile here, but I think its called like so:
    Code:
    <#-- include_virtual('file.shtml') -->
    Or something similar.
    Php uses include as a function:
    PHP Code:
    include('./file.php'); 
    Or, you can use virtual() if you are running on an apache system, which is the same as running an SSI but using php instead for the processor.
    I'm stuck though, I'm not sure what you are looking for. I've suggested the include() for you, and Bill Posters set out a set of links for you to view. So if these don't help you, I'm sorry but I'm at a loss for what your looking for...


  •  

    Posting Permissions

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