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.

Customising the CMS

How to set a default variable for existing pages?


Reply

5 Posts   756 Views

Avatar
SilverRay

12 February 2010 at 1:42am (Last edited: 12 February 2010 2:09am), Community Member, 167 Posts

OK, so I know how to set a default value for a variable in newly created pages using:

public static $defaults = array(
   'SomeVariable' => true
);

But how would I do that for existing pages, so *after* they are created, in an existing site for instance? Just set the value manually in the database? (I mean for many pages at once...)

Avatar
baba-papa

15 February 2010 at 12:34pm Community Member, 279 Posts

Change the code an run [site-url]/dev/build.

Avatar
SilverRay

15 February 2010 at 2:41pm Community Member, 167 Posts

Hmm, no, that does not set all existing pages' "SomeVariable" to true, unfortunately...

Avatar
banal

15 February 2010 at 7:32pm Community Member, 901 Posts

I think you're best off with changing the value manually in the database.

Avatar
SilverRay

16 February 2010 at 1:11pm Community Member, 167 Posts

Yeah, I guessed so... thanks though.