|
Cookbook /
EditAttributes-TalkPlease leave new comments at the top of the page (but below this line). How can I create select lists that work with EditAttributes? Adjust the conditional starting on line 151. Eemeli, please consider adding this to the core!
if(preg_match('/\stype=([\'"]?)checkbox\1/', $InputTags["e_$fn"][':html'])){
$InputTags["e_$fn"]['value'] = '1';
if(!empty($new[$fn])) $InputTags["e_$fn"]['checked'] = '1';
}elseif(preg_match('/<select/', $InputTags["e_$fn"][':html'])){
if(empty($new[$fn])) $new[$fn] = '';
$InputTags["e_$fn"][':html'] = preg_replace(
"/value=\'".$new[$fn]."\'/",
"value='".$new[$fn]."' selected='selected'",
$InputTags["e_$fn"][':html'],
1
);
}
Q: DaveG -- 2-Nov-2009: Is there a way to display a field as a select list? It seems like it may be possible by setting :html, but I'm not sure how to handle the multiple select values. I'm looking at the best way to:
have you any suggestions on how this might best be achieved?
Thanks simon September 08, 2009, at 03:01 AM If I understand correctly, the recipe could handle PageTextVariables like this: $EditAttrFields = array( 'Summary' => array('attribute' => 0, 'markup' => '(:Summary:$1:)');Is this correct? Yes. This probably could do with some more testing, but that should work. You could even have just Does Yes. Setting And in that case, attribute<2, is the change visible in Page?action=diff? If you're modifying the page text, then those changes will be seen under In your own example, you seem to actually remove the Yes.
Where is the attribute "history" saved? --Petko March 20, 2009, at 06:52 AM When saving a page, if Found a conflict with NewPageBoxPlus. With EditAttributes installed I haven't been able to duplicate this on my sites; EditTemplates and NewPageBoxPlus appear to work as intended. Can you give more details about your setup and configuration for the two recipes? —Eemeli Aro May 18, 2009, at 05:01 AM Found and fixed as of 2009-06-01. The title autofill was making the page contents non-empty so EditTemplates() wouldn't trigger. —Eemeli Aro June 01, 2009, at 04:46 AM
Could we include the recipe only if $action=='edit'? Yes. I've now updated the usage instructions above to do just that. I'm unclear as to the the difference between, or the difference in use of, page attributes and page text variables. I'd like to use the recipe to update a set of PTVs currently used across a number of pages in a group. The PTVs are used to generate new pages of content. simon September 20, 2009, at 08:15 PM Talk page for the EditAttributes recipe (users). |