Jump to content

[SOLVED] text files, and php


Recommended Posts

I am parsing a text file, and so far so good, but I need help on this next bit.


I have a file like so


[title]Page Title[/title]

[h1]Main Topic[/h1]

Rest of my content here.


is there a way to read in only the [title][/title] part as a variable, such a $title. Then read in the rest of the file contents.


Here is my current code:

include ("style/xtra/bbcode.php");

$title = fopen("pages/home.txt", "r");
include ("style/xtra/head.php");

$file = "pages/home.txt";
$f = fopen($file, "r");
while ( $line = fgets($f, 4000) ) {
$htmltext = bb2html($line);
echo $htmltext;

include ("style/xtra/foot.php");

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.