charliez Posted March 19, 2012 Share Posted March 19, 2012 If I take a repeater field and make it global with 8 sets of 2 text fields AND I populate some of them, would they hold the values? or do I have to do something extra to save/populate the desired values... Link to comment Share on other sites More sharing options...
ryan Posted March 20, 2012 Share Posted March 20, 2012 I would avoid making a repeater field global, because then it'll require every template to have that repeater field. I can't say as though I've actually tried it though. I'm not positive it would work. So if you have that need, let me know if you find it doesn't. If you don't populate any fields in a repeater, it's considered unpublished. I have the need on a project right now to keep some repeater items published and some unpublished, so currently thinking about ways to do this. I may have a solution soon. Link to comment Share on other sites More sharing options...
charliez Posted March 20, 2012 Author Share Posted March 20, 2012 Thanks Ryan, I thought the same about going Global with the repeater. As you mention, they will appear in the templates that are not going to be published too. Will keep learning PW and will be waiting for your solution... in my case is just convenience (Meta declarations) of not having to fill all of them on each page - just want to input keywords, description for each page and have the rest the same. Link to comment Share on other sites More sharing options...
Adam Kiss Posted March 20, 2012 Share Posted March 20, 2012 I think you don't actually need repeaters for this: there is a definite number of 'SEO' things you can add to meta: Just add two fields into your pages, and in template either take their data where it's populated and use default/none where it isn't. Link to comment Share on other sites More sharing options...
charliez Posted March 21, 2012 Author Share Posted March 21, 2012 So use two "array" fields to put all the Meta info and then just spit them out with a loop? What "array" fields are there to use? Link to comment Share on other sites More sharing options...
Adam Kiss Posted March 21, 2012 Share Posted March 21, 2012 No, not array fields, only regular textareas - one for keywords, one for description: those are regular fields you use, or is there any more? Link to comment Share on other sites More sharing options...
ryan Posted March 21, 2012 Share Posted March 21, 2012 I'm also confused about what the repeater would be here for. If you are wanting to support <title> and <meta description> then I would make two text fields with 255 character maxlength: browser_title meta_description You could make those two global, but I would instead suggest having your templates populate those fields like this: <title><?=$page->get("browser_title|title"); ?></title> <meta name='description' content='<?=$page->get("meta_description|summary"); ?>' /> Using that approach, it'll attempt to use a "browser_title" or "meta_description" field if they are present and populated. If not, it'll default to using the "title" and "summary" field. That way you can add/populate the "browser_title" and "meta_description" fields to your templates as you need them. Otherwise, you'll end up having to populate all of them manually, rather than just focusing your attention on the ones that matter most. I usually keep browser_title and meta_description fields on my homepage template, and templates used by any other major pages (like top level nav stuff). And then it use the title and summary fields for everything else. Link to comment Share on other sites More sharing options...
charliez Posted March 21, 2012 Author Share Posted March 21, 2012 I just wanted to be nifty with PW using the following code: <?php foreach($page->Meta as $m) { echo "<meta name='$m->MetaName' content='$m->MetaContent' />"; } ?> and then create a repeater with all the info of the metas and make it global and pre-populated (hence this thread). But now that I know that: 1) global templates are not good in general (and I had not have luck removing the global from the field) and 2) that a repeater field cannot be used pre-populated (stored values) there is no use for the repeater and I will just use the two fields metaName and metaContent in my template along with the other metas... Thanks a lot for the info and the discussion... I really appreciate it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now