473,831 Members | 2,354 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

include part of a text file

hello all.

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 "

grassy ass,
(Thank You)

Mar 10 '06 #1
3 5434
Assuming "&content=" isnt anywhere else in the txt file, you could use
PHPs explode function like so...

<?php
$textfile= "/usr/local/something.txt";
$handle = fopen($textfile , "r");
$contents = fread($handle, filesize($textf ile));
fclose($handle) ;

$content = explode("&conte nt=", $contents);
print($content[1]);
?>

fopen function..
http://www.php.net/manual/en/function.fopen.php

fread function...
http://www.php.net/manual/en/function.fread.php

explode function...
http://www.php.net/manual/en/function.explode.php

-Nathan

Mar 10 '06 #2
NC
br*********@i-rent.us wrote:

when i use the php command <?php include ("info.txt") ; ?>
There's no need to use include() for anything other than PHP files. If
you just want to output the contents of the file, use readfile()
instead.
Is there any way to use php to just display what
apprars after the &content= in my text file. .... "
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 "


Yes:

list(, $content) = explode('&conte nt=', file_get_conten ts('info.txt')) ;

echo $content;

Cheers,
NC

Mar 10 '06 #3
Thank you so much. This worked like a charm

Mar 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
8014
by: skumar | last post by:
I am a newbie with C++ and unable to understand this warning/error message : localhost > g++ -Wall j++.cpp In file included from /usr/include/c++/3.2.2/backward/iostream.h:31, from j++.cpp:2: /usr/include/c++/3.2.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include...
1
1640
by: RWC | last post by:
Hey Folks! I'm having trouble with an asp page. First off, I'm new to the html / asp world, but not to software development. I'd like to minimize or "normalize" the site, so I'm trying to use one menu page and include it into any page that needs the menu. The problem is, I include the header.asp page, include the menu.asp page, but when I write the body of the page, it sticks the text underneath the side menu. I'd like the text to...
2
1667
by: g_sharad | last post by:
Hi May be this problem is older, however i am not able to find a solution THe problem ... I have asp page file0.asp which calls another asp page thru include. I have to set conditions tht.... originally the include should have file1.asp In the displayed file file1.asp user selects a hyperlink, it should take it as request and display the new file2.asp in same file0.asp in
18
2639
by: Tuckers | last post by:
My question is, if I have created my own library which lives in its own install directory, to refer to its header file is it better to use #include "MyLibrary.h" or #include <MyLibrary.h> Assume that this library will be used by other groups. I think the answer
12
1990
by: Francois Grieu | last post by:
Can #include safely use a preprocessing token, as in #define HEADERFILE "stdio.h" #include HEADERFILE int main(void) {return printf("Hello, world\n")*0;} TIA, François Grieu
5
2514
by: David Mathog | last post by:
One thing that can make porting C code from one platform to another miserable is #include. In particular, the need to either place the path to an included file within the #include statement or to very carefully define the order in which paths are searched with command line options on the compiler. Both can cause problems, especially when dealing with complex software distributions. It occurs ot me that by extending the C include...
26
2676
by: Jan Engelhardt | last post by:
Hello, assume foo/bar.h exists, and is included as '#include "bar.h"' in foo/bar.c. `gcc -c foo/bar.c` will compile it fine (i.e. finds the file). Is this a gcc extension or a C compiler standard feature that foo/ will be searched without explicitly passing -Ifoo? $ cat foo/bar.h #define GOAL 1
111
4701
by: Nate | last post by:
Hello, I am looking for a method to automatically declare variables in C. I'm not sure if there is a good way to do this, but I had something like this in mind... int i; for(i = 1; i < 4; i++){
14
3169
by: Michael | last post by:
Since the include function is called from within a PHP script, why does the included file have to identify itself as a PHP again by enclosing its code in <?php... <?> One would assume that the PHP interpreter works like any other, that is, it first expands all the include files, and then parses the resulting text. Can anyone help with an explanation? Thanks, M. McDonnell
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10534
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9317
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7748
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5620
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5785
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4417
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3076
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.