Posts: 2,094
Threads: 54
Joined: Jan 2011
2011-03-14, 02:40:21
(This post was last modified: 2013-01-06, 02:40:51 by mvlcek.)
As I have been notified that the custom fields of n00dles101's plugin are not correctly displayed when using the I18N plugin (i.e. the values of the default language are always shown), I have improved the I18N plugin to version 0.9.5 ( http://get-simple.info/extend/plugin/i18n/69/). It will now also read all extra fields from the page (correct language version) and make them available via the functions get_custom_field($name) and return_custom_field($name).
Although this works, this is not very nice from an architectural point of view, e.g. page files are read by the I18N as well as the CustomFields plugins, values are available using getCustomField (default language) and get_custom_field (I18N, correct language), etc.
For these reasons I have improved the CustomFields plugin:
- works more efficiently together with I18N plugin (although it also works stand-alone)
- GUI to define the custom fields (no more fiddling with the XML)
- new field types: check box and WYSIWYG textarea
- Version 1.4+: automatically store creation date in page files
- Version 1.5+: Enabled browsing in WYSIWYG editor for links and images
- Version 1.5+: New image field allows browsing for local images
- Version 1.5+: New link field allows browsing for local pages
- Version 1.5+: Current user is automatically saved in field "user"
And - as it uses the same configuration file - it is compatible with the CustomFields plugin (although the CustomFields plugin won't display the new field types).
The new I18N Custom Fields plugin is available at http://get-simple.info/extend/plugin/i18...ields/100/.
If you use the I18N plugin ( http://get-simple.info/extend/plugin/i18n/69/), make sure, it is at least version 0.9.5 (better: 1.1.2).
Installation
Unzip to the plugins directory, then define the custom fields in the administration GUI at Plugins/Configure Custom Fields.
To use browsing with link and image fields, turn on site wide cookies in gsconfig.php:
Code: define('GSCOOKIEISSITEWIDE', TRUE);
Make sure the website base URL matches in the administration settings matches the actual URL.
Usage
Use any of the following functions in your template: - return_custom_field($name) returns the value of the custom field with the given name for the current page.
- get_custom_field($name) outputs the value of the custom field with the given name for the current page.
- get_page_creation_date($i = "l, F jS, Y - g:i A", $echo=true) (Version 1.4+) outputs the creation date of the page - if the CustomFields plugin in version 1.4+ was active at creation time or first update.
Posts: 524
Threads: 48
Joined: Mar 2011
mvlcek,
thanks a lot for your i18n-optimised custom fields plugin. I noticed in Extend that it's officially been tested against 2.03, but have you got it working with 3.0b as well?
I'm running a testsite with 3.0b and wanted to play around with a custom field to be put into the body class attribute for context-specific CSS styling. I (think) I followed your instructions successfully, yet nothing is output.
I defined a new field with the name of "site-language" and put the following function call into the body tag, analoguous to the get_page_slug(); call.
Code: <body id="<?php get_page_slug(); ?>" class="<?php get_custom_field(site-language); ?>">
I then went to a page and entered some value into the new text field. The result is
Code: <body id="some-page" class="">
If you need more info I'll gladly try to provide it.
Keep up the good work!
Posts: 2,094
Threads: 54
Joined: Jan 2011
polyfragmented Wrote:I defined a new field with the name of "site-language" and put the following function call into the body tag, analoguous to the get_page_slug(); call.
Code: <body id="<?php get_page_slug(); ?>" class="<?php get_custom_field(site-language); ?>">
It should work with 3.0b, but you definitely need quotes around the name (not sure why you don't get an error):
Code: <?php get_custom_field("site-language"); ?>
Posts: 524
Threads: 48
Joined: Mar 2011
2011-03-16, 06:47:38
(This post was last modified: 2011-03-17, 19:58:16 by infos.media.)
I just tried it with quotes as well, same result.
I'll enable debugging, maybe that gives us a hint. Edit: no error whatsoever :/ Plus, the textfield on the edit page is not pre-filled with the default I set in the plugin config. Edit2: Prefill with new pages works.
Posts: 2,094
Threads: 54
Joined: Jan 2011
polyfragmented Wrote:I just tried it with quotes as well, same result.
I'll enable debugging, maybe that gives us a hint. Edit: no error whatsoever
Do you use the I18N CustomFields plugin together with the I18N plugin or standalone?
Do you see the entered value in the custom field, when you edit the page again?
If not, is the value stored in the page xml file?
If you are using the I18N plugin, are you displaying the correct language version of the page?
Posts: 524
Threads: 48
Joined: Mar 2011
2011-03-16, 07:16:20
(This post was last modified: 2011-03-16, 07:18:53 by infos.media.)
mvlcek Wrote:Do you use the I18N CustomFields plugin together with the I18N plugin or standalone? I use your custom fields plugin standalone.
mvlcek Wrote:Do you see the entered value in the custom field, when you edit the page again? Yes, the value is persistent after I enter it in the page options. It is stored in the page XML file:
Code: <site-language><![CDATA[de]]></site-language>
Calling it a day for today, will check back here tomorrow again. Thanks for investigating!
Posts: 35
Threads: 0
Joined: May 2010
Hey mvlcek.
I have been trying to get the i18n plugin and the i18customfields plugin to work for a while now. But i am still having problems. Really a noob here on the php end, so hard to debug not knowing what to look for. Anyway I am basing my testsite on GS 2.03.1, and using the latest i18n plugins. and i can create the customfields with no problem and also see that it is being save on the page. but nothing comes out on the site. i just empty. Using for example this line in my templates <?php get_custom_field($mainHeadline); ?> . Any idea what i could be doing wrong or what i could check somehow?
Posts: 2,094
Threads: 54
Joined: Jan 2011
linden Wrote:Hey mvlcek.
I have been trying to get the i18n plugin and the i18customfields plugin to work for a while now. But i am still having problems. Really a noob here on the php end, so hard to debug not knowing what to look for. Anyway I am basing my testsite on GS 2.03.1, and using the latest i18n plugins. and i can create the customfields with no problem and also see that it is being save on the page. but nothing comes out on the site. i just empty. Using for example this line in my templates <?php get_custom_field($mainHeadline); ?> . Any idea what i could be doing wrong or what i could check somehow?
If the name of the custom field is "mainHeadline" (without the quotes), you should use
Code: <?php get_custom_field("mainHeadline"); ?>
Posts: 35
Threads: 0
Joined: May 2010
mvlcek Wrote:linden Wrote:Hey mvlcek.
I have been trying to get the i18n plugin and the i18customfields plugin to work for a while now. But i am still having problems. Really a noob here on the php end, so hard to debug not knowing what to look for. Anyway I am basing my testsite on GS 2.03.1, and using the latest i18n plugins. and i can create the customfields with no problem and also see that it is being save on the page. but nothing comes out on the site. i just empty. Using for example this line in my templates <?php get_custom_field($mainHeadline); ?> . Any idea what i could be doing wrong or what i could check somehow?
If the name of the custom field is "mainHeadline" (without the quotes), you should use
Code: <?php get_custom_field("mainHeadline"); ?>
Of course. Thx works fine now.
Posts: 524
Threads: 48
Joined: Mar 2011
Just tried renaming the custom field name to something without a dash, still the same result. :/ I'm stumped.
Posts: 524
Threads: 48
Joined: Mar 2011
I edited a post further up: Prefill with new pages works..
---
Would it be possible to generate a custom field which is shown n times? I'm thinking of links added to a page via text fields or lists. Maybe something similar to how you manage the dropdown field, but with (un)ordered lists?
Posts: 2,094
Threads: 54
Joined: Jan 2011
polyfragmented Wrote:Would it be possible to generate a custom field which is shown n times? I'm thinking of links added to a page via text fields or lists. Maybe something similar to how you manage the dropdown field, but with (un)ordered lists?
Do you mean a list like a dropdown, but multiple entries are selectable?
Posts: 524
Threads: 48
Joined: Mar 2011
2011-03-17, 20:43:29
(This post was last modified: 2011-03-17, 20:44:41 by infos.media.)
mvlcek Wrote:Do you mean a list like a dropdown, but multiple entries are selectable? Let my clarify, I am looking for a way to input, say, multiple links in a page's options which are then output on-page. In whatever form - (un)ordered lists, definition lists, whatever tickles the fancy.
After re-writing what I'd like to happen, I notice that my mentioning of dropdown fields is probably nonsensical. I can imagine the custom field being put in the page options n times if text fields are used so I can input a handful of links. Not looking for selecting from a pre-defined list by way of a dropdown.
Posts: 1,204
Threads: 30
Joined: Jun 2010
2011-03-23, 02:27:03
(This post was last modified: 2011-03-23, 02:58:51 by BlackRose.)
mvlcek Wrote:The I18N Custom Fields plugin is not yet (fully) compatible with GetSimple 3.0b:- fields are not shown correctly in the edit page view
- WYSIWYG text area has the behavior like the content field in 2.03, thus no browse button.
I've noticed that there's a similar problem I had. You're not escaping commas when saving the file nor loading its content, thus every link pasted in text input won't be displayed, and will break the window after reloading page in edit mode.
Gotta look at mine own changes in Noodle's basic version, as I'd like to use your customfields remake, but it needs fixes.
edit:
k, stripslashes($value) and turning off magic quotes did the thing
Addons: blue business theme, Online Visitors, Notepad
Posts: 2,094
Threads: 54
Joined: Jan 2011
yojoe Wrote:I've noticed that there's a similar problem I had. You're not escaping commas when saving the file nor loading its content, thus every link pasted in text input won't be displayed, and will break the window after reloading page in edit mode.
This should be fixed with version 1.3.
And the texts have been moved to language files - using my Translate plugin has sped this up for sure ;-)
Posts: 2,094
Threads: 54
Joined: Jan 2011
2011-04-01, 03:11:11
(This post was last modified: 2011-04-01, 03:11:31 by nime.)
Version 1.4:
- correctly displays custom fields in page view of GetSimple 3.0
- automatically saves creation date of page - retrieve it with function get_page_creation_date($format = "l, F jS, Y - g:i A", $echo=true).
Posts: 524
Threads: 48
Joined: Mar 2011
2011-04-01, 21:26:54
(This post was last modified: 2011-04-01, 21:27:28 by infos.media.)
Just installed 1.4 into GS 3.0 and, after filling in a new custom field config and hitting save, got the following:
Code: Warning: copy(/www/htdocs/foo/testlab/data/other/customfields.xml) [function.copy]: failed to open stream: No such file or directory in /www/htdocs/foo/testlab/plugins/i18n_customfields/configure.php on line 14
The custom field does not get saved.
What gives?
Posts: 2,094
Threads: 54
Joined: Jan 2011
polyfragmented Wrote:The custom field does not get saved.
Undo preparation was preventing save, if there was no old customfields.xml.
Fixed in version 1.4.1.
Posts: 35
Threads: 0
Joined: May 2010
2011-04-04, 23:05:02
(This post was last modified: 2011-04-04, 23:12:31 by kionar.)
Loving this plugin. And wondering if there would be a way to "link" certain custom fields to a specific template. like for instance if i have 2 pages with different templates. and i would have different informations on them. I would like to have a certain set of custom fields on startpage for example with banner areas or different columns with information. and the standard page would just have content and maybe a sidebar. So different customfields depending on what template i am using. That would make me a really happy man
Might want to add that i would want the certain customfields showing on only that perticular page that i would specify. Otherwise i know i could t it as it is already. But i dont want all customfields showing on all pages. Hope you understand what i mean.
Posts: 44
Threads: 9
Joined: Aug 2009
Hi,
I'm sorry for my English
The plugin works fine, but there is a slight problem.
When I try to insert an image in the main content editor a button "Browse server" apears in the image properties window, but it doesn't in the custom field editor
Is there any chance to fix this?
Posts: 2,094
Threads: 54
Joined: Jan 2011
ragou Wrote:When I try to insert an image in the main content editor a button "Browse server" apears in the image properties window, but it doesn't in the custom field editor
Is there any chance to fix this?
It's on my to do list.
Posts: 524
Threads: 48
Joined: Mar 2011
In the page options right above the "Custom Fields" headline
Quote:Notice: Trying to get property of non-object in /www/htdocs/foo/testlab/plugins/i18n_customfields/edit.php on line 11
Does not seem to affect page saving at all.
Posts: 2,094
Threads: 54
Joined: Jan 2011
Version 1.5 is available:
- Enabled browsing in WYSIWYG editor for links and images (not supported in GetSimple 2.03)
- New field type "image": like text field, but allows browsing for local images (not supported in GetSimple 2.03)
- New field type "link": like text field, but allows browsing for local pages (not supported in GetSimple 2.03)
- Current user is automatically saved in field "user"
@linden: showing fields depending on a template is much too complex to implement (showing/hiding fields, when template is changed, templates are dependent on current theme, ...)
Posts: 35
Threads: 0
Joined: May 2010
mvlcek Wrote:Version 1.5 is available:
- Enabled browsing in WYSIWYG editor for links and images (not supported in GetSimple 2.03)
- New field type "image": like text field, but allows browsing for local images (not supported in GetSimple 2.03)
- New field type "link": like text field, but allows browsing for local pages (not supported in GetSimple 2.03)
- Current user is automatically saved in field "user"
@linden: showing fields depending on a template is much too complex to implement (showing/hiding fields, when template is changed, templates are dependent on current theme, ...)
Ok, yeah i just work at front-end so i dont know what is possible. just a thought. Thx for a super plugin anyway. And just got better with link and image support.
Posts: 346
Threads: 27
Joined: Sep 2010
Thanks again for updating this plugin
When I click on the 'Browse' button given by the functionality of the two new fields, a page does pop up, but it remains blank. Am I doing something wrong?
|