Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Including Part Of An HTML File


Is it possible to include part of a file without including the whole thing?




View Complete Forum Thread with Replies

Related Forum Messages:
Including Txt Html File
I'm converting all my pages to php from shtml files. How can I include the txt files for different parts of the site using php rather than using the includes that I had before?
The text file that I'm using is for the menu and in the text file is all the html for the menu.

View Replies !
Including An Html File In Php Script
how would i include a file that contained all the html code for the display of a webpage in a php fifle so that i dont have to clutter the php with the html.

View Replies !
Reading In A Part Of A HTML File
I am working on a script at the moment, and I want to be able to include some HTML snippets that a user can update at any given time.

In most cases the snippets will be only a table, but I want to make allowances for the file if it is a full HTML file.

What I would like some help in working out, is what would be the best way to read in the file and take all the code after the <body> tag upto but not including the </body>. Is there an eay way of doing this? So that if all I want is the table that is inside the page, that is all I will get.

View Replies !
Read Part/top Of A Remote Output Html File
I'm using file_get_contents{URI) to read/use data in my scripts.

View Replies !
Including Html
I have recently started coding at a new position where I have a
designer that has templates setup. She has different html files that
do different things. Set the doctype, stylesheet, etc. These were
created for server side includes, and works great for html pages, butI
want to include these html files into all of my php pages, and am not
sure the best way to go about it.

I usually create functions for this, but then the designer has to
change the code in the html and the php. Also, in the html where there
is a " I have to change it to " if I use echo to print it out. Is
there a way that I can include the html in a specific location, not
change or copy the html again, or create a set of functions to include
the html and then when I call that function it?

View Replies !
Including Html In Php
does anyone know the full code in which where you include a html page in your php page

e.g

index.php?id=main --->>> came from ---->> main.html

i think it was

<?php require("id$html");?> but it doesnt work ...

View Replies !
Including Html Files
I am looking for a way to combine the functionality of "include" and "here documents" so that an included html file containing $variables is expanded and handled (normally printed to stdout). It would be something like:

print <<<HERE
include file.html;
HERE;

except that, of course, this won't work. The text "include file.html;" will be printed and no file will be included. So it needs to be some other syntax. Does php support this?

View Replies !
Including .txt Files With Html Content
I have a php page and I want to include some txt files within it depending on the URL variable. For example, I have some text files (that contain html code) with these names:

cat.txt
dog.txt
parrot.txt

How can I make the contents of, say, "parrot.txt" appear on the page, if I use a URL like: mysite.com/page.php?c=parrot

"c" stands for "content" and each time I want to include a file, I would use the exact name of the txt file - but without the .txt extention.

I know this is possible and I had the code to do it but it's been over two years and I have misplaced the code.

View Replies !
Including Html And Css Into A Form Email
Alright, so on my website I have a form. Customers can fill it out and an email is sent to a specified adress, blah blah blah.

Now, I need to make a form that does the same thing, but I need to include images and CSS into the body of the email. So far I have not figured out how to do this.

The portion of my script that controls whats in the email is as follows:
$msg2 = "
Name: $name

Email: $email

Phone: $phone

Adress: $adress

City/State: $citystate

Zip $zipcode

Services?: $pruning
$spray_fertilization
$removal_stumpgrinding
$planting
$other
$serviceother

Outline of Work: $outline

Comments?: $comments
";

Simple and easy for just a text based email. When I try to add HTML the whole script just goes kaputt.

View Replies !
Including Png Image With HTML Content
I am asking my visitors to rank 8 different items (a,b,c,d,e,f,g,h) from 1
to 10 and then I want to draw a pie chart of those values. My page
(draw_pie.php) that draws the pie chart works as it should and I link to it
like this ... Code:

View Replies !
Getting Part Of Another HTML Page
I'd like some help with writing a script that grabs part of another HTML page. For example : I want to grab the content of a HTML page that contains the following strings :

<!-- begin --> and <!-- end -->

Then I want to get all the content (including these two tags) that is in between the two tags.

View Replies !
Including External Html But Relative Links Are Broken
I wanted to attach a small "if you like this site bookmark now" message at the top of the external page when anyone click them. I will reformat the outgoing links from URL to GO.php?URL=URL

I try require() first. At go.php when I call require("$URL")  page shows up but relative links and images are broken. I try iframe but I don't want my message always displays (would be ugly). I don't want to use frame either. Can I include aspx or jsp pages too?

View Replies !
Readout The Text From The Database Not Including The Html Formatting.
i have a database entry which is text formatted by html tags, on a page on my site i just want to be able to readout the text from the database not including the html formatting. is tere a simpler way of doing this instead of replacing every html tag with nothing.

View Replies !
Echo A String, Including Html Tags/'unescaped' Php Characters
Is there a way in PHP to echo a string completely without parsing HTML tags and characters which are normally reserved in PHP? For example, this piece of code will not echo to my screen: PHP Code:

View Replies !
How Can I Find Out Parent (including) File Of Included File?
How can i find out parent (including) file of included file?
Lets imagine that we want to for example auto_prepend file to each file on our server that would write out the name of file  its being executed. I know, i can use PHP_SELF but what if i want to write name of file which is already included?

I have a web page and i want on it show its name even if it was included, but not the included page itself is showing name but auto_prepend file to each php file, its duty of this auto_prepend_file to write it out i dont want myself to echo it on each page? do you feel me?

View Replies !
SSI Including PHP File Within PHP File Causes Seg Fault And Crash
Can somebody concur or verify the following? I'm having this problem on all
of my installations.

I've got Apache 2.0.40 and PHP 4.2.2 installed and configured from RedHat
RPMs. Nothing out of the ordinary. In the httpd.conf file, PHP files are
called with the following:

<Files *.php>
SetOutputFilter PHP;INCLUDES
SetInputFilter PHP
LimitRequestBody 524288
</Files>

I create two files as follows:

/test1.php
<!--#include virtaul="/test2.php" -->

and

/test2.php
Testing 1 2 3

By going to http://host/test1.php, it may or may not display the file
contents of test2.php. Usually (9/10 times) I get a seg fault in the error
log. If I change the filename of test.php to test.html and include that, it
works fine. I've tried this on various versions of both Apache and PHP up
to the most recent CVS versions and still get the same results.

View Replies !
Including A File
I am attempting to include a file, but it is not working so well.

Here is my direcoty structure.

Root
|-/file_man
   |-/functions
   |  |-/index
   |     |- top.x
   |-/files
      |-/users
        |-index.php


I am trying to call top.x from index.php using require, but it doesnt work like this

require("/file_man/functions/index/top.x");

any thoughs?

View Replies !
Problem Including The Other Php File.
I want to include three php files in index.php file like the code below. But
it always shows up only two, any two of the three, any order.

<tr>
<td><?php include ("includes/documents.php"); ?>&nbsp;</td>
</tr>
<tr>
<td><?php include ("includes/locations.php"); ?>&nbsp;</td>
</tr>
<tr>
<td><?php include ("includes/status.php"); ?>&nbsp;</td>
</tr>

Can anyone help me out?

View Replies !
Including External File
I have two sites that I am trying to get to "talk" to each other.

I have one site that contains a PHP file that basically outputs an XML formatted list depending on the file structure in that directory.

The other site needs this XML formatted data to complete the PHP generated XML file that I am trying to put together. (Much like syndicating my content from one site to another)

I have tried using readfile, include and header(Location:) and none of them seem to be working. What I need is for the calling file to somehow include the output of the remote file. (The same stuff you see if you view the source) What happens is that I can 'readfile' my index page on that site, but not the one that puts out the XML data that I need. Could it be that the XML file doesn't actually create any visual content on the page? or doesn't have 'head' and 'body' tags?

It would be great if I could do all of this in PHP so that the final source would not include anything that would disrupt the final XML output.

View Replies !
Including A .php File From Another Server?
I am trying to include a function in a .php file on a different server from
the main .php files.

I am using:

include_path=http://www.anotherserver.com/foldername;
include(http://www.anotherserver.com/folder...iletocall.inc);

The .inc file is php formatted. Variables are passed to it (not via GET or
POST though) and returned using return(variablenames, etc);

But for some reason it doesn't appear to work properly.

Am I correct in using the .inc extension?
Are the commands above correctly written?

Basically I am trying to use the fsockopen function in a .php file on
another server where I know it works and return the results to a server
where the fsockopen command doesn't work.

View Replies !
Including A File In Another Frame
I've the following code:

mainpage.php
----------------------------
<FRAME name="framesuperior" src="framesuperior.php?a_caller=inicio">
<FRAME name="framecatalogo" src="frameinferior.php?a_caller=inicio">
----------------------------

framesuperior.php
----------------------------
$a_caller = $_GET['a_caller'];
$a_dhn = $_GET['a_dhn'];

if ($a_caller=="menuprincipal"){ //this file could be called from
another files
include("menusecundario.php"); //this line will update
framesuperior.php
***** Here I need to include "file.php" but in "framecatalogo"
frame

}

View Replies !
Only Including Certain File Types
I have this code which i have taken from php.net and am hopin to have someone tell me how i could modify it to display only one file type (.mid) also this is to stop the script from displaying other directorys as they will automatically load up the index of that directory and won't display a list.

<?
$the_array = Array();
$handle = opendir('/home/www/juttuffi/midi/files');
while (false!== ($file = readdir($handle))) {
if ($file!= "." && $file!= "..") {
$the_array[] = $file;
}
}
closedir($handle);
sort ($the_array);
reset ($the_array);
while (list ($key, $val) = each ($the_array)) {
echo "<a href=http://example.co.uk/midi/files/$val target=_blank>$val</a><br>";
}
?>

View Replies !
Including A .htm File Using An Absolute URL?
i've done some searches on this but most of the stuff i find are to do with including dynamic files and other such advanced PHP which i neither understand nor need. im just a beginner with PHP and actually, this is all im using it for.

so my question is, can i include a .htm file if its on a different server as the php file? im doing it this way because my hosting service doesnt allow SMTP, and the service i hosted the PHP script on, has ads and ruins everything. Code:

View Replies !
Including A File From Mydomain.com
I have a site domain.com that i want to let access some information on a database. So what I am doing is this on domain.com/reg.php I am including a file from mydomain.com that accesses the database. But it isn't printing anything. I am just using

<?
include("http://www.mydomain.com/file.php");
?>

whichi is a simple list from the database.

View Replies !
Error When Including File
Warning: main(1): failed to open stream: No such file or directory in /hsphere/local/home/dezmar/netwack.com/main.php on line 2

Warning: main(1): failed to open stream: No such file or directory in /hsphere/local/home/dezmar/netwack.com/main.php on line 2

Fatal error: main(): Failed opening required &#391;' (include_path='.:/usr/local/lib/php:/usr/local/lib/php/PEAR:/usr/local/share/pear') in /hsphere/local/home/dezmar/netwack.com/main.php on line 2

Those are the errors that i'm getting when loading up my page. How would I fix something like this? Code:

View Replies !
Including A File Referenced
Why does this find the file:

<img
src="<?=$_SERVER['DOCUMENT_ROOT']?>/images/viessmann_header_logo.gif">

But this does not?

$right_content =
$_SERVER['DOCUMENT_ROOT']."includes/content/content.php";

include $right_content;

View Replies !
Including A File Within A Function
I want the variables of the included files to work directly without passing them again to the function my code is not working when the file is included inside the function e.g.

<?
function testing ()
{
include( 'include/session.php' );
echo $session->username;
}
testing();
?>

View Replies !
Problem Including File (intermediate)
I wonder if someone can help me, I've set my web site up as follows:
There is a 'services' page that displays .html pages in a sub-dir when
specified in the URL. I need use the switch function as the code
following shows:

<?php if(isset($_GET['p']))
{
switch ($_GET['p'])
{
// include ('test.inc');
case "test": include "./services/test.html"; break;
case "2test2": include "./services/2test2.html"; break;
default:
}
}
else
{
echo "<p><br><br><B>Please choose a topic from the left</B></p>
";
}
?>

Basically.. I want to use the include(test.inc) file which contains
the two lines of code following it. But I get an error:

Parse error: parse error, expecting `T_CASE' or `T_DEFAULT' or `'}''
in /home/rmgraphics/public_html/services.php on line 27
- which is the include page line and I've commented out for now

I need to use the test.inc file for the case lines because I want to
manage the list by opening the file direct.

View Replies !
Including File And Output To Browser
I am not sure I understand the rules as to what exactly gets output to a
browser and when. If I include a text only file or an html file, these will
show up in the browser regardless of where in the script they are included.

View Replies !
Including Database Config File
I'm facing a problem with including the database config file..

I kept database variables in a config file like this..

connect.php
<?php
$dbhost='something'
$dbuser='something'
$dbpass='something'
$dbname='something'
?>

then in my home.php file I've included that file ( both connect.php and
home.php are in same folder );

<?php
include 'connect.php'
$db=mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname,$db);
//some actions
?>

The above thing worked fine until I moved the config file to root
directoryso that It will be available to all scripts..

the changes I've made to the script.. home.php

<?php
include 'http://domain.com/connect.php'
$db=mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname,$db);
//some actions
?>

the above code this throwing errors..

View Replies !
Including A Standard File In All Directories
I have one layout page that all directories use on my website. How can I make it so that no matter where the file is, the server will always include it. I cannot use direct paths because php will not allow it, and I can't specify the directory for each file. Example.

Layout.php includes files/header.php which includes lib/main.lib.

in Pages/Path/index.php I include ../../Layout.php. Than Layout.php's includes are all messed up.

View Replies !
Including Php File With Str_replace / Ereg_replace
I'm trying to include a php file at a certain point in my template. Including works fine, just it doesn't place it at the right place where I want it to be. The news.php file will be included up front and not at the desired place {content} where it should go to.

I tried str_replace instead of ereg_replace, but str_replace displayed only the news.php page and truncated the rest of the page. Code:

View Replies !
Including Parts Of A Text File
is there a way so that i could only include the first 5 lines of a txt file and have them automaticly break at the end of each line?

im trying to include the first 5 lines from a log file into a server monitoring script im working on.

View Replies !
Class File And Including A CSS Style
I have a class file which contains the classes for the frontend of the site. In some of the functions there are links to various different things.

I tried adding a class attribute onto the link but it doesn't work. So I tried including/requiring the class file and that did nothing but spit the code out onto the page. Any idea what I can do to fix this?

View Replies !
Get PART Of A File (via ID)
So I want to get part of a file, specifically everything WITHIN the div id="left". I have this code, but it gets the whole file. I want to use this to edit a remote file test.html). Code:

View Replies !
Php Form To Allow The User To Enter Part Of A Last Name And/or Part Of A First Name To Display The Data
I'm sure this is not a hard thing to do, but for some reason I can't get my mind to figure this out. I have a database with Name, Address, and Car Type tables. 

I'm just trying to do a simple php form to allow the user to enter part of a last name and/or part of a first name to display the data in the tables. My brain has twisted around this and I cannot figure it out.

View Replies !
Including A File (redirecting Using Header Command)
When including a file in the script or redirecting using header command, for example, should I use a file path:

../../x.php
or
ab/cd/x.php

say cd and ab are previously defined as constants that are the names of immediate parent directory and grandparent directory respectively, which one is better in design, using .. or using constants?

View Replies !
Including External Php File And Executing A Command
I have two different servers, and i need to call a php of server B from server A, so i did this:

SERVER A:

index.php has:
include('http://server-b/file.php');

The content of file.php is:
phpinfo();

... but phpinfo() throws info about server B instead of its parent file SERVER A.

View Replies !
Require_once() Dumping Text Instead Of Including File
Instead of actually including the file i'm requiring, it just dumps it out as text...

other functions are working quite well...

the code look like this:

$forum_version = 'SMF 1.0 RC2'

// Get everything started up...
define('SMF', 1);
@set_magic_quotes_runtime(0);
$time_start = microtime();

// Load the settings...
require_once(dirname(__FILE__) . '/Settings.php');
error_reporting(isset($db_show_debug) && $db_show_debug === true ?
E_ALL : E_ALL ^ E_NOTICE);

// And important includes.
require_once($sourcedir . '/QueryString.php');

After this line:
require_once(dirname(__FILE__) . '/Settings.php');

It just displays the contents of Settings.php as text to the browser - no code execution...
Although dirname(__FILE__) works fine and actually returns the correct directory name of the current file, so i can't really tell if it's a problem with php code execution in general or just this function (require_once)...

View Replies !
Reading Part Of A File
I would like to read say... ONLY the last 200 bytes of a REMOTE, BINARY file. How can i do this?

View Replies !
Searching For A File If I Only Part Of The Name
Using PHP 4.4.4.

What is the easiest way to return the full path of a file if I know
the directory it is in and the beginning part of the file (it will
begin with the word "header")?

View Replies !
Small Part Of Txt File
Im trying to get information from a txt file using two different arrays. I want to store line 1 of the txt file in one array and line 2 to 7 in another array. how i can get started on this?

View Replies !
Part Of A Remote Txt File
the following code returns 2 different things, the correct $filesize (9425) from the header and only part of the text file into $data (2491 bytes)unfortunately, i cannot give out the user and pass. all i can say is that when i run it on my apache server locally, it reads the entire file properly. The split on the remote site occurs between the numbers 1 and 4 in "14", so i have no idea what trips it up.

$filename = 'http://user:pass@mysite.com/testfile.txt'
$ary_header = get_headers($filename, 1);
$filesize = $ary_header['Content-Length'];
$fh = fopen($filename, 'r');
$data = fread($fh, $filesize);
fclose($fh);
echo $filesize . "<br />";
echo strlen($data);

any ideas?

View Replies !
Read Part Of A File
I'm reading this huge text file and I want to start reading from a specific point.
lets say a line in my file is like this
[11/20/2006 12:07:12 AM] abcdel defg0 msping (timeout - 2000 ms)

and i want to start reading from a specific date to a specific date. how would I go about doing that using php?

View Replies !
Get Only Part Of The Remote File?
Is there anyway that I can use curl to retrieve only n bytes/characters
of a file? I want to get some certain information on a remote site, and
the data I need stays somewhere at the middle of the page, so I dont
need to retrieve the whole page, which can save me lots of time.

View Replies !
Appending To A Certain Part In The File
$myFile = "testFile.html";
$fh = fopen($myFile, 'a');
$stringData = "$whatuwrote";
fwrite($fh, $stringData);
fclose($fh);

Something like that, Do you know how to put that into the middle of a file instead of writing it at the bottom of the page.

Example:
echo "hey";
echo "APPEND HERE";
echo "hey";

View Replies !
Include Part Of A Text File
I have a text document that stores text for use in a flash movie. I'm
also using PHP to displace the same text on another page. However the
text document includes 2 tags for use by the flash movie... title= and
&content= ... see text file at end of post ....

when i use the php command <?php include ("info.txt"); ?> it also
displays those tags. Is there any way to use php to just display what
apprars after the &content= in my text file.

I can't remove the tag begause it is required for the flash file
elsewhere on the site.

"
title=CDN HOME &content=The COMPUTER DONATION NETWORK is a resource of
new, used and refurbished computer equipment, software, networking gear
and lab furnishings for "

View Replies !
Include Part Of The File Isn't Working
i have a menu.inc file that i want to use on multiple pages and one of the pages can be found at http://members.aol.com/itsjojofasho/home2.php but for some reason, the include part of the file isn't working when i upload it. but it works when i'm working offline on my computer.

View Replies !
Grab The ID From The DB And Pass It To Be Part Of The Renamed File
I have another file that copy a template from a folder (here for the example: footer.php
to another folder within that folder where now is the new copied "footer.php" I run the following script Which results in "No such file et..." The idea behind $ID is that the new file got to be have a different name than other similar files And got to be unique so I grab the ID from the DB and pass it to be part of the renamed file Well it does not work as planned.

<?
$rename=$id;
$file_name = footer.php;
$read_extension = explode(".", $file_name);
$ext = $read_extension[1];
$renamed = $rename.".".$ext;
rename($file_name, $renamed);

?>

View Replies !
Need A .txt File To Become Part Of A Php File.
I need a .txt file to become part of a php file. Not just as txt, but as php.

View Replies !
Include An Html File In Another Html File?
Can I include an html file in another html file usign PHP? Something like the way you would inlclude a text file, only have the html elements show up?

View Replies !
Including A Class File In Another Class
Trying to figure out a way that my static field $Source can recognize the Enum class...at present, it doesn;t work with the include statement (where it is located now), when the Enum class is instantiated...any ideas? Code:

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved