Posts: 1,108
Threads: 70
Joined: Aug 2009
Hi,
New plugin "CustomFields" for version 2, which as the name says allows you to add new fields to your pages.
At the moment it supports "textbox" and "dropdown" fields, more planned for the next release.
Until we have a repository for plugins, more information and download from here....
http://www.digimute.com/index.php?id=blo...e-2-plugin
Now updated to version 1.3
History
1.3 fixed bug introduced in latest svn
1.2 added dropdown functionality which was ommited from initial release.
1.1 changes hook before template so values are available to your theme
1.1 fixes getCustomField which did not return values
1.0 initial release
Mike....
Posts: 1,848
Threads: 86
Joined: Aug 2009
Thanks Mike... this was easily the most requested feature for plugins... thanks for doing this
- Chris
Thanks for using GetSimple! - Download
Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Posts: 83
Threads: 10
Joined: Aug 2009
Thanks Mike! Yes - I was pushing for a Plugins Forum Topic a while back
Side note: I think I wish plugins sat as it's own top level directory rather than in the /admin. Seems too easy to overwrite admin/plugins during an upgrade. I'm sure there's a good reason for it - just sayin'
Posts: 26
Threads: 5
Joined: Sep 2009
Well, i installed CustomFields - but i still dont know how do use it. Can you please make an example?
Posts: 1,108
Threads: 70
Joined: Aug 2009
Say you wanted to have a different header image on each page. You would have something like this on your theme.
Code: <div id="header">
<img src="yourimage.jpg" alt="" />
</div>
Install the customfields plugin and edit or create /pages/other/customfields.xml
and add the following.
Code: <?xml version="1.0" encoding="UTF-8"?>
<channel>
<item><desc>image</desc><label>Header Image</label><type>text</type></item>
</channel>
Each <item> must have 3 parts,
desc - id of the customfield
label - what to display on the page edit form
type - type of field, either text or dropdown.
if type is dropdown add <option></option> tags with whatever you want in the dropdown menu
Now when you edit your pages you should have a new field "Header Image"
Change your template file to use the following instead
Code: <div id="header">
<img src="<?php getCustomField('image');" alt="" />
</div>
Simple example, check out http://cmstest.digimute.com
which uses 3 new fields to create the portfolio - subtitle, image and jobtype.
Hope it helps, let me know if you need more info.
Mike.
Posts: 26
Threads: 5
Joined: Sep 2009
Ah, ok. Thats great - thanks.
Posts: 4
Threads: 0
Joined: Feb 2010
2010-02-08, 08:07:40
(This post was last modified: 2010-02-08, 08:08:45 by SeanNieuwoudt.)
Hi all, first time posting, although I've had my eye on GetSimple for a while.
I'm developing a website for a client and was about to use my old standby CMS, but with this plugin I could possibly use GS. It's for an architect who has about forty odd projects he wants to feature, so I figured with a CustomFields plugin I could give him fields to plugin in "Project Name" "location" "Project Type", etc. for each of them
I'm trying to get this plugin working and I'm having a bit of a problem.
I can install the plugin with no problem and I see the fields boxes when I go to create a new page in the in the admin.
But nothing I do seems to let me display the info in the rendered template.
For example I created a custom field:
Code: <item>
<desc>projectname</desc>
<label>Project Name</label>
<type>text</type>
</item>
So in the template I put:
Code: <?php returnCustomField('projectname'); ?>
correct? or do I use "getCustomField"? I'm a php noob and have no idea what the difference is...
Either way though, I've done both it returns nothing on the page.
Also, do I add ALL my custom fields in the "customfields.xml" file?
And if I do this:
Code: <item>
<desc>pagetype</desc>
<label>Page Type (Blog/Gallery) </label>
<type>dropdown</type>
blog
gallery
</item>
as per the example on your blog, the dropdown box in the page admin is blank.
And once I get this working what are the html tags for the displayed custom fields? What are the css hooks so I can style them?
And lastly is there a character limit to the "text" option? And if so, can that be changed?
Thanks for your patience with my zillion questions.
Posts: 1,108
Threads: 70
Joined: Aug 2009
Hi,
Just realized I'd left some debug code in the original so the getCustomfield function returned nothing.. 8)
New version 1.1 is available here
http://www.digimute.com/index.php?type=b...e-2-plugin
The difference between the 2 functions is ;
getCustomField should echo the value to screen.
returnCustomField returns it to a variable.
As for the dropdown problem, the XML code rendering on my site is screwing up with the <option> tags so the full example should be
Code: <?xml version=\'1.0\' encoding=\'utf-8\'?>
<channel>
<item>
<desc>pagetype</desc>
<label>Page Type (Blog/Gallery) </label>
<type>dropdown</type>
<option></option>
<option>blog</option>
<option>gallery</option>
</item>
<item>
<desc>publishdate</desc>
<label>Published Date</label>
<type>text</type>
</item>
</channel>
All your customfields should be added to the one file between the <channel> tags.
Naming: each of the new fields has an id/name "post-" + fieldname so you can style.
No restrictions on the text size. Something I can add for the next version.
Hope this helps...
MIke.
Posts: 4
Threads: 0
Joined: Feb 2010
2010-02-08, 21:44:06
(This post was last modified: 2010-02-08, 21:45:57 by SeanNieuwoudt.)
Hi Mike,
Thanks for your answer. I did what you said and downloaded & installed the 1.1 version of the plugin. I can now display the text fields fine, but in the admin section I still get no selectable options in the dropdown box and it renders a blank line in the template . Here's my code in the customfields.xml:
Code: <item>
<desc>projecttype</desc>
<label>Project Type</label>
<type>dropdown</type>
<option>Residential</option>
<option>Commercial</option>
<option>Estate</option>
</item>
Also in the rendered template, I see now the information I put in the admin in any text box displayed, but there are no html tags around it. So I am assuming the plugin doesn't add any unless that's how I code in in the template, correct?
So in the template I can put, for e.g.
Code: <ul class="project-information">
<li><?php getCustomField('projectname'); ?></li>
<li><?php getCustomField('projectlocation'); ?></li>
<li><?php getCustomField('projecttype'); ?></li>
<li><?php getCustomField('projectdescription'); ?></li>
</ul>
And then I could use .project-information ul etc. to style the output? (if so this is great, perfect...just want to make sure that the plugin isn't supposed to be adding any div, p, etc. tags by itself my install isn't doing that...
Lastly the tag lets me output the content I put in the admin, is there a way to also display the "label", i.e something like this:
Code: <ul class="project-information">
<li><?php SOMESORTOF PHPWIZARDRY 'projectname' label ?></li>
<li><?php getCustomField('projectname'); ?></li>
</ul>
So it would render like this on the webpage:
- Project Name
- Freds Project
Otherwise I can just handcode it I suppose ala:
Code: <ul class="project-information">
<li>Project Name</li>
<li><?php getCustomField('projectname'); ?></li>
</ul>
But if I could pull out the 'label' from the custom field that'd be cooler...either way..
Thanks again...so it's just the why isn't the dropdown bit working..
Thanks again so much.
Posts: 1,108
Threads: 70
Joined: Aug 2009
Well I messed up again !!! 8)
In my rush to release the plugin I forgot to actually code the dropdown functionality...
My test version is running my initial code where it does work.
New version 1.2 can be downloaded now.
http://www.digimute.com/index.php?type=b...e-2-plugin
Which fixes the dropdown issue.
It doesn't style any of the output, thats up to you in the theme.
All the new fields should be available in the $tags Array in your theme.
so you should be able to use
Code: echo $tags['projectname']['label']; // output the label for the projectname field.
echo $tags['projectname']['type']; // output the type of field
echo $tags['projectname']['value']; // output the value of the field, can be used instead of getCustomField('projectname');
Hopefully this sorts it out...
Mike.
Posts: 4
Threads: 0
Joined: Feb 2010
Mike..
Thanks so much, everything is working great. Is there any way to control the size of the text field entry on the admin page options? For some a single line entry box is fine, but for longer text the size is a bit limiting...
Thanks
Posts: 1,108
Threads: 70
Joined: Aug 2009
Hi,
At least it all working fine now... 8)
As the form is built using a 2 column table were limited to 2 sizes, half and full size...
they will be available in the next version.
At the moment no, but you could set the css of the element.
Mike...
Posts: 6
Threads: 1
Joined: Feb 2010
2010-03-05, 03:58:55
(This post was last modified: 2010-03-05, 04:00:38 by Rebecca.)
mike,
hi,
getSimple 2.01 rc3
customFields plugin 1.2
data/other/customfields.xml just one test text item like this one
<channel>
<item>
<desc>test</desc>
<label>test</label>
<type>text</type>
</item>
</channel>
Admin Side :
------------
a test page (testpage.xml), in the test custom field I add a value xxxx.
- Save Updates
- If I manually edit the testpage.xml, the custom fields xml tags and values are appended ->ok
- In the template <?php getCustomField('test');?> ->ok, return xxxx
the problem is : back to admin side / editing testpage / the custom fields always display blank values
I made several tests with different kind of inputedit : same problems, after saving a page, the custom fields values are not displayed on the admin side of a page.
this is not really a big problem but a very confusing one.
a createTagInputs() problem ?
hope my above text is explicit enough.
marc
marc
Posts: 1,108
Threads: 70
Joined: Aug 2009
latest version breaks the plugin as it uses $_GET['uri'] instead of $_GET['id']
So to fix if quickly.... just change line 118 of customfields.php , change 'uri' to 'id'
Will update the download version... couldn't figure it out myself earlier... 8)
Mike.
Posts: 6
Threads: 1
Joined: Feb 2010
correct now
thanks mike
marc
Posts: 5
Threads: 0
Joined: Mar 2010
guys, pls show some demo, i don't understand how it will be helpful in my site) Pls)
Posts: 972
Threads: 27
Joined: Aug 2009
2010-03-13, 01:40:00
(This post was last modified: 2010-03-13, 01:40:23 by vsky.)
It’s helpful if you want to have multiple fields to fill out when editing a page. That’s all. The plugin can be used to add as many custom fields as you want, those can be called from your template to display it at different places. So if you’re a developer and want to give a client just that extra option, you can add it to your template without having to change the GetSimple core.
Hard to make a demo, just give it a try.
Posts: 5
Threads: 0
Joined: Mar 2010
Ok, now im understand. Thank you Zegnåt! It's a helpful mod)
Posts: 161
Threads: 6
Joined: Jan 2010
Thanks noodle, works great. I added a textarea field type for my requirements.
Code: case "textarea":
echo '<td colspan="2">';
echo "<b>".$tags[$key]['label'].":</b><br />";
echo "<textarea id=\"post-".strtolower($key)."\" name=\"post-".strtolower($key)."\">".$data_edit->$key."</textarea></td>";
break;
Posts: 9
Threads: 3
Joined: Mar 2010
I'm curious of how hard it might be to add <template></template> to the xml file and then use custom templates to call corresponding custom fields in the "Page Options" area of 'edit.php'?
You would only display the custom fields that are assigned to a particular page template.
Does this make sense?
Posts: 972
Threads: 27
Joined: Aug 2009
It wouldn’t be so hard, but it wouldn’t really be easier to use. The problem is that the fields under Page Options are created when you first open a page to edit, so if you switch the page’s template it will not automatically go and check what tags might be needed. You’ll need to write some Javascript to keep everything in sync.
Posts: 44
Threads: 9
Joined: Aug 2009
2010-04-22, 06:41:39
(This post was last modified: 2010-04-22, 06:47:27 by tquinnelly.)
Custom fields are the weakest part of every CMS I've tried last few years. Unfortunately, without custom fields all we get is cloning a page and edit its main content. But if we are talking about a small website up to 10 pages, using CMS by an advanced web developer just doesn't make sense. It takes much less time and efforts, simply to write pages by hand and link them altogether. CMS is for people with little, or none knowledge of html, php, etc.
I can't wait for a good, workable and easy to install custom fields plugin.
Posts: 1,108
Threads: 70
Joined: Aug 2009
Cant see what could be much easier than whats there,
copy the plugin file to your plugin directory and create a single XML
file for your customfields.
What improvements would you like to see?
Mike.
Posts: 44
Threads: 9
Joined: Aug 2009
Obviously it's not so easy. Zegnat says that it's hard to make demo.
You say in your site:
Quote:To use the new fields in your theme you can use the functions:
getCustomField($tag); // echos the returned value
or
returnCustomField($tag); // returns the value
What is this?
How to "use" it?
Put it in the page code, or theme code, or both?
Put them as they are, or between <? ?>?
I understand that when someone has been written a program he understands it, but not all of the others do.
Never mind.
Best regards.
Posts: 972
Threads: 27
Joined: Aug 2009
ragou Wrote:Obviously it’s not so easy. Zegnåt says that it’s hard to make demo. Of course it’s hard to make a demo… I’ll have to give you access to my server to be able to take a look at the responsible XML-file, next I’ll have to give you access to my admin panel so you can see what happens when you change the contents of a custom field. It’s hard to demo, because it’s not obvious that a website is using the plugin if I just were to show you a GetSimple installation.
This has very little to do with how hard it is to use this plugin. Using it is pretty easy, demoing it stinks.
ragou Wrote:What is this? It’s a plugin that enables you to add extra fields to the editing page of your admin section. Maybe you want to write a different copyright statement on all your pages, using this plugin you can add a field “Copyright†under “Page options†when you’re editing a page just for this!
ragou Wrote:How to "use" it? You create a XML-file, as described on Mike’s plugin page, that tells the plugin what fields you would like to have added in the “Page options†box of your admin section. Now this extra data will be saved by GetSimple.
ragou Wrote:Put it in the page code, or theme code, or both? Either in a component or directly into the theme’s file(s). These are the only places that accept PHP (unless you’re using the Exec-PHP plugin by Chris).
ragou Wrote:Put them as they are, or between <? ?>? Mike assumes that, as he calls them functions and most people will be putting them in their theme’s template file(s), you realise he’s talking about PHP functions. These will always need to be defined as such by putting them between <?php (sometimes just <?) and ?>.
Hope this answers most of your questions!
|