static pages

A place for users and developers of the Xataface to discuss and receive support.

Postby vlad » Wed Jul 25, 2007 5:47 pm

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.
vlad
 
Posts: 28
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Wed Jul 25, 2007 6:55 pm

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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Postby vlad » Wed Jul 25, 2007 8:06 pm

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.
vlad
 
Posts: 28
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Thu Jul 26, 2007 11:11 pm

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
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 23 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved