Jump to content


Corporate Sponsors


Latest News: (loading..)

Harald Ponce de Leon

Member Since 31 Aug 2002
Offline Last Active Today, 13:48
*****

Topics I've Started

Template Engine Functionality Proposal

03 February 2012, 10:54

Hi All..

This is a proposal for adding actual template engine functionality into osCommerce Online Merchant v3.0 to remove PHP code from the content pages.

The proposal is shown through the development of our new website powered by the osCommerce Online Merchant v3.0 framework. The source code to our new website is published as Open Source (BSD license) however it will not be part of osCommerce Online Merchant v3.0 as it is obviously not a general purpose application. As soon as the template engine functionality is finalized, it will be added to the v3.0 framework to not only implement it to the Admin, Setup, and Shop sites, but to also kickstart the initiative of adding a general purpose CMS Site to osCommerce Online Merchant v3.0.

The template engine functionality is currently aimed at developers. An Admin Application will be needed for users to be able to edit page content and see which template engine functionality is available to them.

The source code of our website and the initial template engine functionality is available at:

https://github.com/haraldpdl/oscommerce_website

Instructions for setting up the website is available at the github repository. It is currently only the front page to demonstrate the template engine functionality.

The idea behind the template engine functionality is to NOT add logic into content pages where users and developers need to learn yet another language for conditions or loops - PHP does this just fine.

The idea is to "widgetize" content pages through the use of simple tags used in addition to HTML. Simple processing is taken care of with Tags and more powerful and modular processing is taken care of with Widgets. Both Tags and Widgets are called in the following format, similar to bbcode:

{tag}value{tag}

No closing {/tag} is used - only matching {tag}{tag} pairs are processed.

The following tags are available:
  • import - include html content from another file
  • lang - get language definition
  • link - produce a url
  • publiclink - produce a url to a public asset
  • value - get the value of a variable
  • widget - process widget
Each Tag is a module. The template processing does not search for a hardcoded list of tags to process, but searches for {[tag-name]}string{[same-tag-name}] and processes "string" with the Tag if the module is available.

It's possible to nest Tags and by default the same processing is also executed on the output of the Tag, for example using {link}Index{link} is possible in a language definition. This can be disabled at the Tag level if it is not required.

It is up to each Tag to process the string value as it requires. Some Tags may need arguments to be passed - both link and publiclink Tags use | as a separator in the string value to process arguments, example {link}Index|Shop{link} would create a link to the Shop Index page, not to the Index page of the current Site.

For cases where more complex arguments are needed, a variable can be pre-set at the Site level to make it available to all of its Applications, or at the Application level specific for that Application. This is contained in $OSCOM_Template->_values[] and the value can be retrieved with the {value} Tag.

Widgets are used where coding logic is needed or to add independent blocks to a page. Each Widget has it's own language definition file and can be added to any page.

Please take a look at the source and provide feedback on the direction this is going in. Caching will need to be looked into.

Thanks!

Database Documentation Feedback

17 January 2012, 21:26

Hi All..

The first draft article documenting the database class is ready for feedback! Please take a look and provide suggestions for improvements.

http://forums.oscommerce.com/page/docs/_/oscom/30/developers/database-connections-and-queries-r9

Thanks,

Forum Software Upgrade (12th January 2012)

12 January 2012, 01:05

Hi All..

The forum software has been upgraded to the latest version. This is a maintenance upgrade that addresses minor bugs.

Please post any issues you may find here in this topic.

Thanks!

Kind regards,

Forum Channel Rules Updated

28 November 2011, 11:48

Hi All..

The forum channel rules have been updated. The "Powered by osCommerce" line rule is no longer a requirement for live shops to be discussed here.

Kind regards,

Paul Clifford (pdcelec) Sudden Loss

13 September 2011, 11:46

Hi All..

I am deeply saddened to inform the sudden loss of Paul Clifford (pdcelec) who passed away on Sunday night.

Paul was of great help to the community and had great passion in life and in work.

I thank John, a great friend of Paul, for informing me of the loss.

My condolences to Paul's family and friends. He is honored and will be missed in our community.