Page 1 of 1

splitting content

Posted: Sun Apr 10, 2005 10:32 pm
by bladecatcher
I'm using a template like script to build pages.
I'm also using sessions to authenticate access to members and guests.
The content component is in xhtml.

Now I'm at the testing stage, I've started to prepare a few of the xhtml files and realised a lot of the content is an amalgamation of 'guest' and 'member' stuff. I don't really want to have a separate page for each class of user, with largly identical content.

I'm wondering if I could modify the xhtml files to xml and use tags to decide what to display?

i.e. the stuff enclosed by the <member> tag should only be written to a member session.

Code: Select all

&lt;h1&gt;My Page&lt;/h1&gt;
&lt;p&gt;&lt;em&gt;16/03/2005&lt;/em&gt;&lt;br /&gt;
Sorry, we were offline for a few hours this morning, someone tripped over the extension lead.
&lt;/p&gt;
&lt;member&gt;
&lt;p&gt;
&lt;strong&gt;&lt;em&gt;03/03/2005&lt;/em&gt;
&lt;br /&gt;
Barton Mawer WINS at Australian Grand Prix (&lt;a href=&quote;lindsay/bartonmawer.htm&quote; target=&quote;main&quote;&gt;more&lt;/a&gt;).&lt;/strong&gt;
&lt;/p&gt;
&lt;/member&gt;
I've read the W3C tutorials on XML.

My question is: Is there an easy way of separating the content without having to parse all the xhtml tags as well as the xml tags???

apologies in advance as I realise I have not phrased the question well (cringe).

Thanking you in anticipation,
bladecatcher


feyd | Please review how to post code using

Code: Select all

and

Code: Select all

tags. Read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]

Posted: Thu Apr 14, 2005 3:51 pm
by feyd
you can use the regular expression or go ghetto with explode().


Moved to PHP - Code. (parsed by PHP)