- Code: Select all
<!-- DEFINE $LEFTHANDCONTENT = 'html for lhs' -->
<!-- DEFINE $RIGHTHANDCONTENT = 'html for rhs' -->
<!-- INCLUDE glassbar.html -->
Among other things, I'm using this glass bar as the header for my posts, and this is where the fun starts. $RIGHTHANDCONTENT is going to be all the post action icons (Edit, Delete, Quote, etc.) - and that will have to be built up using the logic that's already in the prosilver template, depending on the current user's permissions. In pseudocode:
- Code: Select all
$RIGHTHANDCONTENT = 'html for any common stuff';
if(can quote) {
$RIGHTHANDCONTENT = $RIGHTHANDCONTENT + 'html for quote button';
}
if(can edit) {
$RIGHTHANDCONTENT = $RIGHTHANDCONTENT + 'html for edit button';
}
if(can delete) {
$RIGHTHANDCONTENT = $RIGHTHANDCONTENT + 'html for delete button';
}
How do I do this using DEFINE? Without this ability, it seems I have two alternatives:
i) DEFINE far more variables, say $RIGHTHANDCONTENT1 through $RIGHTHANDCONTENT10, and modify the template to concatenate them, empty or not,
or
ii) re-implement all this perfectly good template logic in PHP and template->assign_var a single string.
Neither of these strikes me as being particularly nice. My background is JSP, where I'm used to doing <c:set var ="myVar">${myVar}new stuff on the end</c:set> - am I expecting too much of the templating system here?

