Jump to content

[SOLVED] text files, and php


Lamez

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:

<?php
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
https://forums.phpfreaks.com/topic/136610-solved-text-files-and-php/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.