Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom Fields from $slug
#1
Is it possible to get custom fields from differrent page? Maby combination of Custom Fields & Page Excerpts?

I need to have picture as a link to page. Picture is defined in custom fileld calld 'foto' in each page.

Best regards.
Grzegorz
Reply
#2
With Mike's PagesXML (page caching/indexing) plugin you can use these functions:

getPageField($page,$field) - Echos the Field of the requested Page
returnPageField($page,$field) - Returns the Field of the requested Page

These functions work for default and custom fields.

That's for GS 3.0.
With 3.1 it will no longer be necessary to install the plugin, as it is included. (See: http://get-simple.info/wiki/config:caching-function )
Reply
#3
It will not work quiet the same in 3.1 i'm afraid...
as I wrote both plugins I was able to include any customfields that had been included with my plugin in the origianl pages caching plugin...

In 3.1 version it only caches the default settings. There is a hook to include customfields which plugin
writers must utilize....

Still haven't figured out the best way to do this... once I do I'll update the wiki docs....

Mike...
My Github Repos: Github
Website: DigiMute
Reply
#4
Ok, very nice work on this plugin, but still I can't access custom fields.

In PagesXML info I have only default fields.

Any sugestion what could be wrong ?
Reply
#5
grs84pl Wrote:Ok, very nice work on this plugin, but still I can't access custom fields. In PagesXML info I have only default fields. Any sugestion what could be wrong ?
My guess is you're using the I18N Custom Fields by mvlcek and maybe the PagesXML plugin is only compatible with the original Custom Fields plugin by n00dles101.
Modern UI Admin for GetSimple
Watch the demo. Install this plugin. Use this CSS. Enjoy.
Reply
#6
sal Wrote:My guess is you're using the I18N Custom Fields by mvlcek and maybe the PagesXML plugin is only compatible with the original Custom Fields plugin by n00dles101.

Good guess! Not tested, but almost sure.

@grs84pl
This should work, edit PagesXML plugin's pages.php, change line 304:
Code:
if (isset($plugin_info['customfields'])){

to:

Code:
if (isset($plugin_info['customfields']) || isset($plugin_info['i18n_customfields'])){
Reply
#7
Yes that will work. I won't be updating that plugin any more as it is now included in the core.

I've fixed the latest SVN version so any customfields from any plugin are now included in the cache....

Mike...
My Github Repos: Github
Website: DigiMute
Reply
#8
@grs84pl

Another possibility I hadn't mentioned, a plugin I started time ago to make it easy (or at least, how I like) to display other pages' fields. GS Page Data allows you to select an external page, then use some template tags to display its contents.

What you need could be done by inserting in your template/component/... something like this:
Code:
<?php set_gspage('page-slug'); ?>

<a href="<?php gspage_url(); ?>"><img src="<?php gspage_field('foto'); ?>"
alt="<?php gspage_title(); ?>"></a>

that would be echoed like:
Code:
<a href="http://site.tld/page-slug/"><img src="http://site.tld/data/uploads/image.jpg"
alt="The other page title"</a>
I think it would work for you. Custom fields containing html should be filtered before echoing -- I will change that in gspage_field() in a next release (and other issue it may have).

This plugin is mainly for personal use, but if you or anyone is interested I will push its development. (I will probably rename it to GS Pages, change some functions/parameters...)
Reply




Users browsing this thread: 1 Guest(s)