Template Parsing System Feedback

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
Envex
Forum Newbie
Posts: 13
Joined: Fri Sep 23, 2005 2:51 pm

Post by Envex »

Hey, great... A thread on template parsing. Here's something I'm working on now, and any input would be greatly appreciated. Here's what I posted on my own developer forums to get input:

For example, below shows an XML request used for the Setup->Member Settings menu:

Code: Select all

<xml>
<admin_header />
<form menu="setup" action="member2" />

<header_font>Member Settings</header_font>

<paragraph>
Welcome to the <b>Member Settings</b> section, where you can manage all member types within the system.  Lets hope the new XML back-end engine 
works good this time.
</paragraph>

<if variable="_success_create"><success>Successfully created new member type, ~type_name~</success></if>
<if variable="_success_edit"><success>Successfully updated member type, ~name~</success></if>

<section>Existing Member Types</section>

<function alias="display_table" table="member_types" />

<form_button>
	<submit>Edit Member Type</submit>
	<submit>Delete Member Type</submit>
</form_button>

<section>Create Member Type</section>

<function alias="display_form" form="create_member_type" />

<form_button>
	<submit_reset>Create Member Type</submit_reset>
</form_button>

<admin_footer />
</xml>
By using just this XML request, with no outside PHP code, the below page will be displayed to the user's web browser. Click on the image for a larger version.

Image

FUNCTION XML TAGS

Especially take note in the two <function> XML tags in the above request. While the framework is processing an XML request like this, for every <function> tag it knows to send a request to the appropriate back-end function. In reality, every <function> XML request looks something like:

Code: Select all

<function system="member" module="member_type" action="create" />
Within the back-end there are various systems, and each system can contain multple modules, and each module contains various functions. The above request informs the framework of the exact function to execute, and which system and module that function can be found in. However, the framework does support function aliases. Instead of having a <function> tag with all three variables every time, you can define an alias for that function, then simply use that within the XML tag. The software then looks up the module, system and action attached to the alias from the database, and uses that.

THE display_table AND display_form FUNCTIONS

With the above XML request, the framework executes the display_table and display_form functions, which are core functions in the system. The first function retrieves and displays a table listing all member types within the system, and the second function displays all form fields required to create a new member type. The new framework allows for both, internal forms and tables, each of which can be called using the above <function> tags. Defining a form or table is extremley easy, and nothing more than adding a few records into the database. The software then retrieves the information on the appropriate form / table, parses it accordingly, and results in the above image.


ANOTHER XML EXAMPLE

Below is another example of an XML request that can be used within the Admin Control Panel to create a new member in the system:

Code: Select all

<xml>
<admin_header />

<function alias="create_member" />

<paragraph>
Successfully created the new member, ~username~.  You may view the new member's self replicating web site by going to:
<br /><center><a href="~member-site~">~member_sie~</a></center>
</paragraph>

<section>Member Profile</section>

<function system="member" action="display_profile" username="~username~" />

<admin_footer />
</xml>
This is the XML template displayed after someone submits the Database->Create New Member form to manually create a new member. Within the above request, you will notice the <function alias="create_member" /> XML tag. When the software encounters this tag, it knows to contact the back-end and execute the create_member function, meaning that any distributor or client can easily create a new member by using a simple XML tag. By providing developer for the new framework, you can also easily create your own system, modules and functions which distributors and clients can easily execute through the same XML tag.

Thanks,
Matt
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Thread split from here.

Since you are wanting feedback on your own ideas, and that thread is quite old (2003 was the last post) this thread was broken off into its own instance.
Post Reply