Guest comfy Posted May 20, 2006 Share Posted May 20, 2006 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. Quote Link to comment Share on other sites More sharing options...
convict Posted May 20, 2006 Share Posted May 20, 2006 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 :( Quote Link to comment Share on other sites More sharing options...
markscarts Posted May 21, 2006 Share Posted May 21, 2006 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 :( Quote Link to comment Share on other sites More sharing options...
Guest comfy Posted May 21, 2006 Share Posted May 21, 2006 Thank you, gentlemen. The clues helped. I got it to work. Quote Link to comment Share on other sites More sharing options...
convict Posted May 21, 2006 Share Posted May 21, 2006 You are welcome ;) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.