Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

adding pages directly to the database


Go to End


3 Posts   1932 Views

Avatar
Nicolaas

Forum Moderator, 224 Posts

22 May 2007 at 11:12am

Hi Folk

I am putting together a large site and I would to add pages directly to the database rather than adding them through the CMS interface.

If I just create a temporary php page that connects to the database and runs "INSERT INTO SiteTree_Live ...... " statements then would I get in trouble or would this just work?

Thanks a million

Nicolaas

Avatar
Sam

Administrator, 690 Posts

22 May 2007 at 12:25pm

You should use INSERT INTO SiteTree

And then visit admin/publishall to publish all the pages to SiteTree_Live

If you have any custom fields in, for example, Page, you will need to go INSERT INTO Page as well.

Avatar
Ingo

Forum Moderator, 801 Posts

22 May 2007 at 1:26pm

Unless its really performance-critical, i'd rather bump up the available PHP-memory and create SiteTree-objects. There's just too much stuff in SiteTree/Hierarchy to bypass the model-layer and do everything yourself (especially when you want to publish pages etc.).
If you have access to a shell on your webserver, webhosts often grant more execution time and memory if you execute a php-script on commandline.