Javascript Tooltips, Popups, Captions - BoxOver  

Go Back   Javascript Tooltips, Popups, Captions - BoxOver > BoxOver > Suggestions
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
  #1  
Old 03-30-2007, 03:23 AM
gilgamesh gilgamesh is offline
Junior Member
 
Join Date: Mar 2007
Posts: 3
Default Implemented: Templating

I've implemented templating for Boxover.

Templating would be useful for components that are used a number of time on the one page, especailly when used inside tables. I personally use complicated forms within Boxover inside big tables, so adding templating makes pages that were once half a meg(rediculous), down to a normal size(<50k).


Before I posted the code, I was just wanting to know if anyone had suggestions on the best way to implement the templating syntax.

To define template, I placed the templates in empty span objects placed inside the body tags near the boxover script reference. I use _boxover_templates to determine if templates have been defined, and use _boxover_templates_<template name> to access the component directly. I actually dont know how I would access the sub control from the parent control without looping and doing a id check - which seemed pointless. Replacable fields(merge fields) are indicated by the field name replaced with percentage signs eg. %field%.

HTML Code:
<span id='_boxover_templates'> <span id='_boxover_templates_myName' template='Hi my name is %name%. People call me %nick_name%'></span> <span id='_boxover_templates_myAge' template='Hi my name is %name% I am %age% years old'></span> </span>
(Keep in mind this is a very very simplistic example)

Also, would there be compatability issues using empty SPAN's?


To use the template I added two new fields, one to define the name of the template to use, and a second to define the merge fields and their values. The best idea I could come up with to confide the content - which could be anything - was to use <~ and ~>, separating fields with a semi-colon. I probably will need to change it to something else, Im not confortable with the angled brackets being in there. Maybe (~~), or two characters you wouldn't normally see together:

HTML Code:
<span title="header=[Title] template=[myName] mergefields=[name:<~Gregory William~>;nick_name:<~Greg~>] body=[]">My Templated Popup!</span>
Obviously if you are using HTML inside your boxover you will need to covert it into something friendly to boxover. If you use PHP, I've posted a smarty script somewhere which can be used to make this process automatic.

Last edited by gilgamesh : 03-30-2007 at 03:28 AM. Reason: Naming error in HTML
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 06:12 AM.