Re: I can't make a 'read_tag.php' file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



And the HTML output is:

<HTML>
<BODY>
<h1>Test readTag-functie</h1>
<br>Length = 160<br>Of Tag = 14<br>Of Str = 115<br>Of End =
31<br>TagData:<br><bttag=bassie>
I am myself!!
</bttag>
<bttag=test>
This is a test!!!
</bttag>
<bttag=welcome>
Welcome!!!
</bttag>
<bttag=close>
Closing!!!
</bttag>

I am myself!!
</bttag>
<bttag=test>
This is a test!!!
</bttag>
<bttag=welcome>
Welcome!!!
</bttag>
<bttag</body>
</html>


"Bas" <bas_timmer49@hotmail.com> wrote in message
20031012100159.84607.qmail@pb1.pair.com">news:20031012100159.84607.qmail@pb1.pair.com...
> The output of the function is:
>
>
> Length = 160
> Of Tag = 14
> Of Str = 115
> Of End = 31
> TagData:
> I am myself!! This is a test!!! Welcome!!! Closing!!! I am myself!! This
is
> a test!!! Welcome!!!
> "Bas" <bas_timmer49@hotmail.com> wrote in message
> 20031011175734.76113.qmail@pb1.pair.com">news:20031011175734.76113.qmail@pb1.pair.com...
> > I have found that this script doesn't work:
> >
> > read_tag.php
> >
> > ---
> > <?php
> >
> > function readTag($filename, $tagtype, $debug = 0) {
> > $filedata = file_get_contents($filename);
> > $tagrealname = "<bttag=";
> > $tagrealname .= $tagtype;
> > $tagrealname .= ">";
> >
> > $tagdata = stristr($filedata, $tagrealname);
> > $posofend = strpos($tagdata, "</bttag>");
> > $length = strlen($tagdata);
> > $lengthoftag = strlen($tagrealname);
> > $lengthofend = strlen("</bttag>");
> > $lengthofstr = $length - $posofend - $lengthoftag;
> > $returndata = substr($tagdata, $lengthoftag, $lengthofstr);
> > if ($debug == 1) {
> > echo "<br>Length = " . $length;
> > echo "<br>Of Tag = " . $lengthoftag;
> > echo "<br>Of Str = " . $lengthofstr;
> > echo "<br>Of End = " . $posofend;
> > echo "<br>TagData:<br>" . $tagdata;
> > }
> > return $returndata;
> > }
> > ?>
> >
> > <HTML>
> > <BODY>
> > <h1>Test readTag-functie</h1>
> > <?php echo readTag("test.tag", "bassie", 1); ?>
> > </body>
> > </html>
> >
> > ---
> > And with this, it needs the file 'test.tag'
> > ---
> > <bttag=bassie>
> > I am myself!!
> > </bttag>
> > <bttag=test>
> > This is a test!!!
> > </bttag>
> > <bttag=welcome>
> > Welcome!!!
> > </bttag>
> > <bttag=close>
> > Closing!!!
> > </bttag>
> > ---
> > The first parameter of the readTag function is the filename of the tag
> file.
> > The second is the tag to search for an the third is the debug mode.
> >
> > The error is that if i load this, the readTag function returns
everything
> > except for the Closing!!!
> >
> > What's wrong?

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux