FORUMS CLOSED DUE TO SPAM. YOU STILL CAN ADD POST!

Behaviors and Views

Feed 8 posts, 4 voices

Avatar
4 posts

First off, I’m new to Frog, trying to figure it out. I’ve been evaluating a number of CMS apps, and so far Frog seems to be the best.

However, I’ve found that Frog’s Pages system is missing a few attributes that I absolutely need. I’ve played with M’s Page Metadata and Page Part Forms plugins, and they are great but not quite what I looking for.

In a nutshell, here are my needs:

Each page needs to have a:

  1. Title
  2. Body
  3. Intro (not all pages will have this, but many will)
  4. Promote on Home Page (this would be a checkbox, Boolean sort of thing)
  5. Publish Date (for delayed publication)
  6. Expiration Date (to hide an entry on a specified date, not all pages will have this, but many will)

Frog’s Pages have the first two by default, and the the third with “page parts”. Four thru six can sort of be achieved with the Page Metadata and Page Part Forms plugins, but neither have the default functionality that I want.

What I think I want to do is extend the Page class itself, and Frog Behaviors seem to be the way to do that. My theory is that I can create an Extended Page page type with the all the features I need.

My questions (for now!) are:

  1. How can override the default Page edit view?
  2. If I extend the Page class thru a Behavior, do I also need to extend PageController?
  3. What am I missing?

My goal is to achieve the desired functionality without hacking Frog’s core. If Frog’s framework is as flexible as it’s layout/snippets system, this should be pretty straightforward.

Thanks!

 
Avatar
1493 posts

You may have seen these notes already, and I’m not sure how much help you’ll find there in any case — but have a look at the Google Code wiki page for ‘Behavior’.

 
Avatar
11 posts

3. You can add a page part called “intro” to the pages you want and in layout add a code which checks for this page part and shows it if it is not empty.
4. This feature is really missing. What I am doing now – is changing the page system to make a page can be a child of several pages at the same time. So I can make a first page layout that will “promote” it’s child pages and when I’m adding a new page which I need to promote I will also make it a child of first page.
5. Isn’t it a “published” date on “Page Meta” page?
6. Also missing, I guess you need to add a field in “page” table of DB and use it in your layouts and snippets.

 
Avatar
4 posts

@david: Yes, I saw that wiki entry.

From the Behaviors wiki entry:

  • A behavior is what you can apply to a page to make it different!
  • A behavior is passed on to all children (descendent) pages
  • A behavior can redefine all page functions by overwriting them by extending the Page class

But there’s no info on how to deal with a new Behavior on the View level.

@stas: For #4 what I was planning on doing was writing some sort of query for the home page that would retrieve all the pages with the promote_on_home_page attribute set to TRUE. Then it would display the Intro page part.

For #5, yes there is a Published Date field in the Page metadata tab, but it doesn’t work quite the way I think it should. I want a page with a publish date set in the future to NOT be visible until that date, essentially act as though it has a status of Reviewed or Draft until that date.

 
Avatar
11 posts

4. I’ve decided not to change the Frog’s core, but write a plugin, which will add a “categories” functionality. This will add a new tab to the backend where you can create/manage your personal categories. Also this will add a list of labels on “Edit page” page where you can choose one or more categories for the page. For the front end this plugin will extend the page object with “categories” property, so you’ll be able display pages that belongs to one or more categories in the almost same way as display page’s children.
5. Also I can add a simple query to this plugin which will be executed every time the root page accessed (may be it’s not the best way, but I don’t want to use cron and don’t know other ways). This query will be looking for pages with status set to “reviewed” and “published date” set to the past date(or time) and change their status to “published”, so if you create a page with status “reviewed” and “published date” set to the future this page will not be displayed until the date you’ve set, but on or after this date it’s status will be switched to “published” and it will be displayed. Also I can add another field in “page” table of DB called “expiration date” and write one more query which will be changing page status to “reviewed” or “hidden” after that date.

 
Avatar
1493 posts

@jedfoster – on #4 – you could readily do this with a page-part (e.g. “homepage-promo”), and with the word “true” or “false” in it, then use the cs_children_by_part plugin (link to plugin on MadeByFrog site > Extend) to pull the correct pages, aggregated from across your site. It works. It’s even easy, once it’s set up. ;)

@stas – your “categories” sounds a lot like “tags” (see the Tagger plugin). What am I missing?

@both – future-publishing has long been on the wish-list. It would be nice to have!

 
Avatar
11 posts

@David – Hmm… seems like I need to be more patient exploring list of plugins already written :) Thanks.

@all – I still like an idea of writing plugin for future publishing and page expiration. The questions are:

Should I:
1. make a db request runs every time the root (or any) page accessed or there is a better way?
2. use “published on” field or add another field in “page” table, or add one more table which will have fields (id, page_id, publish_date, expiration_date and not change original “page” table?
3. use “reviewed” page status or add “waiting to be published” and “expired” states?

Any other ideas or wishes? I’m planing to write it on this weekend.

 
Avatar
4 posts

@david: I suppose that that all of my items could be achieved with page parts. However I really dislike the tabbed textarea layout of page parts. I need a form that is instantly recognizable and obvious. I want to be able to turn the website over to relatively inexperienced users. (see a screen shot below)

Re: future publishing, I was envisioning a SQL query such as: SELECT * FROM `page` WHERE `published_on` <= NOW() or whatever the equivalent would be in Frog.

@stas: I’d say go with your second option. I don’t see any reason NOT to use the existing `published_on` column; then all that’s needed is to extend whatever query Frog currently uses to retrieve published pages with a clause similar to what I wrote above. A “pending publication” status might also be useful, but wouldn’t be essential.

I’d love to help out with this if you’d like. Shoot me an email at jed AT (my username) DOT com.

@all: Thanks for weighing in on this. I really appreciate your input. If I can get this worked out, Frog could be a killer app for me.

Here’s a screenshot of what I want my page edit scren to look like:

 
Avatar
20 posts

Greeting everyone!
We are the professional Guild Wars 2 Gold supplier-www.guildwars2buygold.com .
To satisfy amounts of players’demand that we have prepared sufficient [url=http://www.guildwars2buygold.com]Guild Wars 2 Gold[/url] in stock!Come here to buy cheap GW2 Gold and enjoy fast delivery service will bring you different experience.
Relibale Guild Wars 2 Gold stock can support you buy GW2 Gold at anytime with lowest price.24/7 live chat are pleased to help you!