splitting content

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bladecatcher
Forum Commoner
Posts: 67
Joined: Sat Mar 12, 2005 12:50 am

splitting content

Post 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]
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you can use the regular expression or go ghetto with explode().


Moved to PHP - Code. (parsed by PHP)
Post Reply