Jul 27, 2008

Getting Content From A Different File

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > HTML, XML etc..

free web hosting

Getting Content From A Different File

kvarnerexpress
Hey,
I think this would be simple to html programmers.. but not to me.
I got a website template to make it easy, and there are boxes at the side that i can just put text in. But what I put in these boxes I want to appear on every page of the site. So by doing that i put a piece of code in telling it to get the text content from an external file. How would I do this? Here is the string at the moment.

Code:
CODE
<TD COLSPAN=3 background="images/image_45.jpg"><div align="center"><font color="#FF8000" size="2" face="Verdana, Arial, Helvetica, sans-serif">insert here</font> </div></TD>

Reply

rvalkass
This can be done very simply in many different programming languages, except for HTML. For some reason there is nothing in HTML that seems to work correctly.

However, in PHP, you can simply use the include() function.

Where you have 'insert here' replace it with:
CODE

<?php include('filename.htm'); ?>


Then, make sure that you save the file with the extension of .php rather than .html

If you have any more problems feel free to email or PM me.

Reply

jlhaslip
First of all, what sort of info will be in the file and ultimately in the box? How large is the Table cell?
If the 'box' is large enough, it might be a place to use an iframe to insert information, but there may be scrolbar and or viewport size issues that won't be nice.
Sample here.
Other than that, I don't think Html by itself will handle dynamic info.
Use php 'includes' to fill the box with text is an option, too. Simply 'include' a file by name. The server needs to be php enabled for php scripts to run, though.
CODE
<?php include 'filename.txt' ?>

I have a script which requires php enabled to run it and it looks up stuff from flat files.
This Sidebar Generator script looks for files within a specific folder and displays the file names as links.
This Other One reads a list of folder names from a flat file and creates a list of links using the same techniques as above for several folders.
In either case, the list of links is based on the folder contents at the time the script is run. If you want to change a link list, upload/ddelete a file to the various folders.

So it kinda depends on the nature of the content you want to include inside the box, and how 'dynamic' it is.

 

 

 


Reply

Sprnknwn
Iīd do what rvalkass and jlhaslip suggest. I donīt know any way to make it only with html.

But only in case you arenīt familiar with php, notice that you wonīt get the result of the includes simply by viewing your website from your HD. You need to have it hosted in a server that understands and execute php scripts, like this (trap17). smile.gif

Reply

jlhaslip
The requirement to have files renamed can be avoided by altering your .htaccess file to include a line as per http://www.trap17.com/forums/index.php?sho...ndpost&p=222937

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : content file

  1. Html Ascii Codes - A Complete List - downloadable php file (3)
  2. Iframe Src = A Local File In My Computer - (6)
    Is it possible to call a file, i.e. 1.htm, from my web browser using such tag HTML iframe src
    =" file:///C:/1.htm "> /iframe > file:///C:/1.htm is the correct path since when I
    enter it to my web browser's address box it shows up properly. But when I use the same call
    function in my PHP it does not. My situation is that I'm running Apache with PHP, therefore I
    am running my own mimi-webserver on my computer. There's no risk of someone else accessing my
    file because it's for my testing purpose. I thought it had to do with some Apach...
  3. How To Make Cms For My Dynamic Website? - A Content Management System (3)
    It is a pain trying to have to write new code everytime you want to change something on my website.
    I know there is an easier way to update content. I read about COntent Management systems which
    apparently use XML. When I would enter the administartion area there woudl be dynamic fileds in
    which I could edit the data and when I click submit it would change. The thing is that I know how
    to add these forms to a page but I dont know how to create an adminstration area. I use php and one
    of my friends said to use XML. I have a book but it is taking a long time to read....
  4. Getting An Image To Scroll On With Content - (13)
    ok, well i had had people review Hogwartsmagic.net and they said that i should get it to not be one
    huge image as a layout..and i have figured most of it out and it has proven sucessful! but now i
    am having diffuclty, i am pretty much only a basicl HTML kinda person... and i was wondering if
    anyone knows an html code that will allow one image to scroll the entire length of a pages content?
    for example, if i were to add 200 links to the right navigation..the image would go with the
    content.. i am testing it out here HERE any help would be much appreciated...
  5. Html Help: Div Cuts Off Unexpectedly - html bug: failure to encompass all content (6)
    Hey guys, I'm making a new template because I decided that I needed a much simpler one that
    goes with the times. Template here: http://nerdnirvana.org/newlay0ut/v3.htm As you can see,
    everything looks fine, but if the content area is smaller in length than the sidebar, then the
    layout screws up because the layout refuses to expand to encompass everything. Link:
    http://nerdnirvana.org/newlay0ut/comments.htm Does anyone know what I can do so that the layout
    expands if necessary? I tried clearing the div, but that doesn't help. Thanks!...
  6. Integrating One Html File Into Another - without embedding (27)
    Hey guys I'm overhauling my website and have decided instead of using frames I want to just
    have a logo and buttons integrated into each HTML file, so you can just scroll down past it. I want
    the logo at the very top, before any content. I was wondering if there is any way of doing it with
    an HTML tag (i.e. not PHP or any other scripts) so the header just gets inserted right after the
    opening tag. I'm thinking that possibly it uses the tag, but really I don't have much of
    an idea. Thanks in advance for your suggestions. Peace out /smile.gif' border=...
  7. Xml And Asp - Displying XML file with ASP (1)
    Hello ! I needed to display xml files rather RSS feed from different sources into an ASP file
    .. Just like Google news. Actually i have the asp script but can anyone give help me make css or
    xslt file for that xml file so that i can display news like google thanks...
  8. Word.doc Or Pdf Formatted File To Display In A Web - How to maintain the formatting??? (12)
    I have a document which was originally created using ms office word processing with very strict
    formatting requirements. It is a high level academic paper which I would like to make viewable
    within a web page complete with the original formatting. I also have it available as a pdf file with
    the same formatting. Regardless of the format, is there a way to convert this highly formatted
    document into an html page and retain the formatting without major work? The only way I have been
    able to do this so far is with the use of a table layout , an iframe, and the client havi...
  9. Makeing A Div Thing Go From Top To Bottom, - regardless of its content. (3)
    ok so i dont really know how to call this so if someone know a better title please let some mods
    change it. I want to make a site that goes 100% page diagonaly. and has a border image left and
    right. since this probably makes no sense at all ill show you the page i designed in Macromedia
    Fireworks and maybe you will understand. i hope someone can help me. ...
  10. Box Content - how do i create some? (5)
    /wink.gif' border='0' style='vertical-align:middle' alt='wink.gif' /> i want to know how to
    create a box content? and how to make them with color i dont need to know the color codes like
    #000000 i know that /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> i
    just want to know how to make a box content to but text inside ect. Thanks for your help.
    -Microsoft...
  11. Page Content Shifts In Different Browsers - (4)
    The content on my pages either shifts or looks recognizably different between IE and Mozilla Firefox
    browsers. I formatted the text with css classes hopping that might help. However, that didn't
    help this problem. The page doesn't look the same in IE and Mozilla Firefox. What can I do to
    fix this? Thanks, kvarnerexpress ...
  12. Play Sound File Without Media Player Showing - (3)
    Currently I have ICONS (JPGs) on a number of my pages that, when clicked, allow the user to hear a
    specific audio (WMA)file related to the page. The problem is that when the icon is clicked, the
    audio file plays, but it opens (in this case) the Windows Media Player. I am trying to avoid that
    from happening. My workaround is to create a separate, new window (small in size), that opens and
    has the sound file attached to the background of the new window, playing automatically when opened.
    This works... I can also make about 30 of these little windows for each of the 30 s...
  13. Executable Instead Of Html File - (2)
    I have a HTML file which I use to logon to my account easily It When I open it I get a normal HTML
    page in frond of me where I can push the button to login to my webpage. Is there a possibility to
    open the HTML file and go directly into my page? Now it uses input fields like this which are
    hidden: It would be nice if someone knows how to make a sort of a executeble out of it, so I
    only have an icon on my desktop which I can use to login. This is the file in total which I use
    now: E-Mail en Agenda <script language="javascript" type="text/javascript...
  14. File Ristrictions On Xml (.wmz) - (1)
    What lead me to this trap website is geocities would not let me upload documents I created with word
    that contained formulas. The created web pages used xml. The files they would not except where
    called xml skins and had the extension (.wmz) Anyway this will make my 10th post so hopefully I can
    put more thought into my posts now....



Looking for content, file

Searching Video's for content, file
advertisement



Getting Content From A Different File



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE