Paul Hoehne wrote:
> When I set they page type on a page to "Simple" and try to access the  
> page, I get a 404.
> 
> Examining the log and injecting logger statements it seems that the  
> find_by_url method on the page is unable to locate the slug of the  
> virtual page:
> SELECT * FROM pages WHERE (pages.parent_id = 1) AND (pages."slug" =  
> 'simple') LIMIT 1
> Returns a row when executed from a postgresql console session  but  
> fails to return a row when executing inside of Radiant.

That's because of this code:

http://dev.radiantcms.org/radiant/browser/trunk/radiant/app/models/page.rb#L128

By default, the find_by_url method is setup to not find virtual pages. 
Most of the time, in order to use a virtual page you need anotheranother 
page type that overrides the find_by_url method. This is exactly what 
the archive page does:

http://dev.radiantcms.org/radiant/browser/trunk/radiant/app/models/archive_page.rb#L18

with the archive index pages:

http://dev.radiantcms.org/radiant/browser/trunk/radiant/app/models/archive_day_index_page.rb#L14
http://dev.radiantcms.org/radiant/browser/trunk/radiant/lib/archive_index_tags_and_methods.rb#L43

> I can also make the page a env dump page, for example, and don't get  
> a 404 error.  When I turn the page back into a "Simple" page, I go  
> back to 404-ville.

Right. That's because the env dump page is not a virtual page. Virtual 
pages don't show up in standard queries.

What exactly is a virtual page? That's a hard question. The simple 
answer is it is a page does not have its own URL. The File Not Found 
page is an excellent example. You wouldn't want the File Not Found page 
to show up in search results or a list of a page's children. Because of 
this it is marked "virtual". Queries for displaying pages should, for 
the most part, exclude virtual pages.

--
John Long
http://wiseheartdesign.com
_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to