How to create pages programmatically?
|
486 posts
|
Has anybody done this? I'm talking about creating pages without using the GUI. I need something like an API... |
|
51 posts
|
Hi,
See the Page model (in |
|
486 posts
|
thanks gido, i'll check it out! |
|
651 posts
|
I'm not sure it is wise to use Frog internal code to do that. Any method you see which is prefixed with an underscore (_) should be considered off-limits since it is a private method and might change in future Frog versions. If you explain why you're trying to add a page programmatically, we might be able to point you in the correct direction or simply add a method to the Plugin API to provide the functionality you need. |
|
486 posts
|
hi mvdkleijn, i have a dynamic mashup page and i want to do snapshots of it once a day so i can have an archive of how it looked on any given day. so i just want to automate and cron the procedure of creating the archive pages. thanks for any advice! |
|
651 posts
|
So you have a page with dynamic content which changes daily (couple of rss feed for example), and each day you want to save that day's content so people can refer to it later for example.... My guess is you could go one of three ways with this:
Option 1 would require the least amount of work I guess since it would probably be a "simple" copy-paste of content kind of action. Downside would be the number of pages it creates and a possible lack in overview for content editors. Option 2 is more similar to the current "Archive" plugin's behaviour and thus more in line with Frog's "style" if we have any. ;-) Anyway, this would also give you the most flexibility with regards to accessing the data in custom ways. Here the downside is that it would require more work to do properly and the database might grow very quickly in size. Option 3 is the least desirable in my humble opinion since it would require having disk access, would require you to write and read files to disk, have the appropriate permissions, etc. etc. My advice? Use option 2.... If you really don't want to do that, I guess we can put a createPage method (and related methods) in the Plugin API. I think that probably wouldn't be a bad idea anyway. I'll discuss that with the guys to see if they like it. |
|
486 posts
|
mvdkleijn, thanks for your post. with regard to option 1, is it any different than the blog posts? i havne't used the blogging feature of frog, but if you wrote a post every day wouldn't that also create a large number of pages to manage. what is frog's way of dealing with this? is there any sort of pagination? |
|
1493 posts
|
@ricks - deep in the recesses of my "mind" there was a memory that this came up once before. I managed to find this thread on "paging in the admin". I think that's the only place it has come up before. Something worth thinking about? |
|
651 posts
|
@ricks – with regard to option 1, is it any different than the blog posts? Actually, the blog/archive posts are using a system more similar to option 2. The main difference between your plugin and the Archive plugin is that your plugin (correct me if I’m wrong) displays a single page which automatically(?) changes its contents every day. You then automatically store that days content in an archive somehow. The Archive plugin actually is just a collection of normal “static” posts and a method of displaying a sorted list of those posts based on creation date. @David – I agree we’ll have to figure out a method of dealing with large number of pages in the admin section of Frog. I created this issue for the problem… Though it’s not one we’ll solve easily I think. Do we have any large 2000+ pages sites available to get performance data from? |
|
486 posts
|
@mvdkleijn, Thanks for your advice. I think what I want to do is similar to the way that Article pages are currently archived, so that's probably the way to go. I'll take a look at the way it's designed. Instead of discussing pagination here, I think we should open another thread on that. |
|
486 posts
|
Is this in 0.9.4 by any chance? |
|
651 posts
|
Nope… there wasn’t an issue/feature request recorded for this in the issue tracking system so I kind of forgot about this. (hint.. hint..) ;-) |
|
486 posts
|
darn! alright I guess I’ll have to use the evil google issue tracker… |