Page 1 of 1

PostPosted: Wed Jul 25, 2007 5:47 pm
by vlad
how can I add static pages to a df website ? (like this website's about section). Is this possible without building a new action ? (-action=my_static_page)

thanks in advance.

PostPosted: Wed Jul 25, 2007 6:55 pm
by shannah
Hi Vlad,

There's a few approaches you can take. If I want to have a few static pages and make them editable through the web browser, I will generally add a 'pages' table to store the web pages (see the LCMS application for an example).

Another option is to create a custom action with a template.

e.g.
[mypage]
template=mypage.html

Then mypage.html would have:

{use_macro file="Dataface_Main_Template.html"}
{fill_slot name="main_column"}
my content ... blah blah blah
{/fill_slot}
{/use_macro}

Another option is to just add a page to your application's pages directory.
e.g. Add pages/mypage.php
then you can access the page with
index.php?-action=custom_mypage

You can use mod_rewrite to make nice urls to any particular page you want.

-Steve

PostPosted: Wed Jul 25, 2007 8:06 pm
by vlad
I think i'll use the "template=mypage.html" method. I currently have a .php file in actions subdirectory for static pages.
How can I have the page listed in the "tables_menu" (like you have on this website)?

I have a few more questions if you don't mind:

1.How did you make this expandable navigation menu? For example when you click "about" the menu expands showing a few subcategories "Dataface Features" ... etc.

2.How can I tune the bread crumbs to show the location more exactly. Eg: (In the librariandb demo) the book "Samson and Delilah" is listed under the "Bible Story" category and the bread crumbs show "You are here: Books :: Samson and Delilah" (instead of "You are here: Books -> Bible Story -> Samson and Delilah"). I can see that the bread crumbs are more precise on this website " You are here: Home ? Forum ? Dataface Users ? static pages".

Thanks alot.

PostPosted: Thu Jul 26, 2007 11:11 pm
by shannah
A couple of things:

1. This website is powered by Plone (http://plone.org), a content management system that runs on Zope. I used some of the plone stylesheets for the dataface look and feel, so the look it similar.

2. In response to your questions:

How can I have the page listed in the "tables_menu" (like you have on this website)?

Try overriding the Dataface_NavMenu.html template.

How did you make this expandable navigation menu? For example when you click "about" the menu expands showing a few subcategories "Dataface Features" ... etc.

This is done in plone. It isn't hard to create your own sort of expanding menu with a little css though.

How can I tune the bread crumbs to show the location more exactly.

There are a couple of ways to do this. The best way is to implement the getBreadCrumbs() method in the delegate class.
This method should return an associative array, where the keys are the titles, and the values are the urls of the breadcrumbs.

for example:

Code: Select all
function getBreadCrumbs(&$record){
    return array(
         'Home' => DATAFACE_SITE_URL,
         $record->display('category') => DATAFACE_SITE_HREF.'?-action=list&-category=$record->val('category'),
         $record->getTitle() => $record->getURL('-action=view')
         );
}


That method would return breadcrumbs like 'Home :: Bible Story :: Samson & Delilah'

Another method would be to just override the bread_crumbs slot and use your own logic.

e.g.
Code: Select all
function block__bread_crumbs(){
    echo "This is some stuff that should show up instead of breadcrumbs";
}


Best regards

Steve