Jump to content

{CUSTOMBOX} with variable contents


Guest comfy

Recommended Posts

Guest comfy

I need a custom box whose contents vary with the category of stuff chosen. I found two posts on how to do this, followed both of them as best I could, and while I don't get any error messages, I also don't get a box.

Here's what I've done:

Added the following include in index.php:

include("includes/boxes/poem.inc.php");

$body->assign("POEM",$box_content);

Created a poem.tpl in skins\legend\styleTemplates\boxes which consists only of the following:

<!-- BEGIN: poem -->

<div class="boxTitleLeft">Reflection</div>

<div class="boxContentLeft">

<div class="txtSiteDocs">

</div>

</div>

<!-- END: poem -->

Changed index.tpl in skins\legend\styleTemplates\global to add:

{POEM}

Created poem.inc.php in \includes\boxes. Poem.inc.php which contains a reference to the tpl:

$box_content = new XTemplate ("skins/".$config['skinDir']."/styleTemplates/boxes/poem.tpl");

Most of the x.inc.php files in the same folder end with something like:

$box_content->parse("currency");

$box_content = $box_content->text("currency");

I thought I'd set a variable to the text I want inside the box and replace "currency" with the variable. Doesn't work. Nor do any of the hundreds of other variations I've tried.

$box_content = "some text"

DOES put "some text" out on the page, but not inside a box.

What does the notation ->parse("xxx") mean? What, for that matter, does -> mean? (Clearly, I don't know php.)

I'd appreciate any help.

Link to comment
Share on other sites

You are close to the final solution. "Parse" is the magic word to 'execute' appropriate content assigned to template variable and template content. You may parse piece of template content or whole template it depends to what part of template is parsed.

Be aware, BOX templates are a piece of main-global template :(

Link to comment
Share on other sites

By analogy, look at the other files in includes/boxes/ . . . notice all the parse statements like

$box_content->parse("sometextname");

Then look to corresponding skin box template, for every one you will see something like

<!-- BEGIN: sometextname -->

<!-- END: sometextname -->

What looks like html comments is actually a cue telling php where to parse :(

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...