forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gav...." <brightoncomput...@brightontown.com.au>
Subject Best way to add repeatable code in v2/v3 (was Re: Example use case)
Date Sat, 21 Jan 2006 12:06:23 GMT
Hi All,

On the right hand side of http://minitutorials.com I have some 'headlines' 
in a 'headlines' div
All boxes are in a 'rightbar' div also.
The code for this is in One file called rightnav.ssi and included using 
either 'include' or 'require'
This obviously has the effect that all of the site pages get the content 
from the one file.

I have been looking at how to do this using dispatcher method.

What I have tried :-

1. Create Hooks as required to get the div and css to position it.

 <forrest:hook name="headlines">
   <forrest:hook name="rightbar">
     <forrest:contract name="search-input">
            <forrest:properties contract="search-input">
              <forrest:property name="search-input">
                <search name="minitutorials" domain="www.minitutorials.com" 
provider="google"/>
              </forrest:property>
            </forrest:properties>
    </forrest:contract>
  </forrest:hook>
  </forrest:hook>

As you can see I have added a search-input so the div shows on the site and 
is present at http://apache.minitutorials.com

2. Then I looked through ls.contracts and found one I thought might be 
suitable as replacement of 'include/require'
Adding the code for it into my hooks above I ended up with :-

 <forrest:hook name="headlines">
   <forrest:hook name="rightbar">
     <forrest:contract name="search-input">
            <forrest:properties contract="search-input">
              <forrest:property name="search-input">
                <search name="minitutorials" domain="www.minitutorials.com" 
provider="google"/>
              </forrest:property>
            </forrest:properties>
    </forrest:contract>
<forrest:contract name="content-include-html">
    <forrest:properties contract="content-include-html">
      <forrest:property name="content-include-html" 
nugget="get.nugget.include.html">
       <url>/rightbar.html</url>
      </forrest:property>
    </forrest:properties>
</forrest:contract>
  </forrest:hook>
  </forrest:hook>

(content-include sounds just what I need)

3. The html code required I transfered from rightnav.ssi into rightnav.html 
and put this file
into xdocs directory. I am hoping that the <url>/rightbar.html</url> is 
therefore correct.

4. Didn't see what else I would need to do, so did a 'forrest run' , did not 
show up.
    Also did a ForrestBot onto the web server, also does not show up.

So, this did not work, the question is, have I done something wrong, missed 
something out
or is there a different/better way to include content into the 'headlines' 
hook ?

Alternative I thought of would be to create a contract for it. Although I 
can see how to
create a contract, not sure again on the best way of approaching it. Maybe 
doing a similar
thing as including the body from say index.xml but using 
rightnavcontent.xml, use jx: ??

I am sure I am missing the obvious, a pointer would be great :)

(Re-reading the above, I see at least (at last ?)  I have suggestions, so 
must be learning something!)

P.S-

Creating an empty hook has the side effect of a self closing div - obviously 
inlvalid and messes
up the rest of the page.

e.g.

<forrest:hook name="headlines"></forrest:hook>
creates
<div id="headlines />
instead of
<div id="headlines"></div>

Gav...



-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.375 / Virus Database: 267.14.21/236 - Release Date: 20/01/2006



Mime
View raw message