Thread Rating:
  • 3 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I18N Special Pages
QuestarDean Wrote:Does anyone know of any reason (or ever experienced) why you can't put the tags straight into the template...? I have tried many variations but just can't get it to work... I know you can enter the HTML/PHP in the 'View' box when you are setting up the special pages, but the reason I would like them in the template is because they are quite spread around the page, and would much prefer them defined in the template assigned to that special page...

I may be missing something quite obvious, but if anyone could help, it would be much appreciated... (excuse all my dots... bad habit!)
Quick and dirty solution I use in my templates is the caching functions:

Echo: <?php getPageField($slug,$specialfield); ?>
Return: <?php returnPageField($slug,$specialfield); ?>

These are global for all page types, so they should work for you.

As for your second problem, I'm not sure what's happened. Just so you know (to my knowledge), if you change your default template in the Special Page's settings that only affects the pages you make after the changes. So pages you've made prior to that change will need their template changed manually. Check that their templates are indeed the correct ones in their .xml files in your data/pages directory.
Reply
Hi Angryboy.

Thanks for the feedback. I like the 'Dirty' solutions you use and may implement them in future for such things as 'See also...' links etc.

As for the second part, I have checked the xml files and some of them had the old 'template.php' still in there, but even after changing, still I can't get them to work...

<?php get_special_field('membername','Default Value',true); ?>

This just brings in the 'Default Value' bit as if it can't pick up anything for the given field. Out of curiosity, is there anything wrong with the names I am giving the fields? too long or something? I can't imaging them being used elsewhere...

Maybe I will just have to use the 'View' pane in Special pages, but I can imagine my code will be very messy in there... Thanks for the help up to now guys, and keep up the good work!
Reply
On a side note, I have just replaced:

<?php get_special_field('membername','Default Value',true); ?>

with

<?php get_custom_field('membername','Default Value',true); ?>

and it pulls in correctly.

I am using custom fields plugin too, but even after disabling, and using the first tag above, still get nothing... This will do for the time being. If anyone else comes across and can advise, it would be much appreciated. For now tho, I will be quiet...

Note: Is I18N plug in a necessity for this to work?
Reply
The custom fields syntax works because it works globally for all page types. The caching function also works globally, but even without custom fields installed, so generally I stick to the caching functions (unless I need to manipulate the information in a specific way before it is output).

With your problem on your members.php file, first check if the template is working at all to begin with, because it sounds like there could be a general error in the mark-up. I'm a little confused when you say 'nothing comes up' - do you get just a blank white page? Or do you get some of the page but the page content doesn't show up?

Oh and if you edit the .xml files directly, open and resave those pages from your GetSimple admin panel as well to refresh the cache (that might be why it is still treating the page's template as the default one despite you manually changing it).

*edit* No, I18N is not necessary for you to use any of the similarly branded plugins. :-)
Reply
Hi Angryboy.

Thanks for your feedback again. The markup in the HTML is fine as I've tried taking bits out... The rest of the page shows, it's just where I put the tag - <?php get_special_field('membername','Default Value',true); ?> - rather than fetching the contents of the 'membername' field, it just displays 'Default Value' in it's place, as if it can't see anything in the field or something...

If get_custom_field is ok to use then I am happy to go with that, just wondered if it would cause problems further down the line.

Many thanks for your help.
Reply
It's okay :-) I'm just hoping that your problem is actually being sorted with this assistance.

My only reasoning for not wanting to use the custom_field syntax is because I had to fix a slightly messy syntax-related problem for my news stemming from calling both the custom and special fields. That was my own fault though: it could have easily been avoided if I wasn't lazy xD

If custom fields work for you then just use it but be wary of that for now. If you still need to have a default value in place, using the following:

Code:
<?php if(return_custom_field('membername')!='') get_custom_field('membername'); else echo 'Default Value'; ?>

Or for the caching/indexing function:

Code:
<?php if(returnPageField(return_page_slug(), 'membername')!='') getPageField(return_page_slug(), 'membername'); else echo 'Default Value'; ?>

Both should work in your template files.
Reply
Can probably also be written as something like this.

Code:
echo !empty(return_custom_field('membername')) ? return_custom_field('membername') :  'Default Value' ;
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
Any chance of making pubDate an editable field as part of your plugin mvlcek?

I looked at using a separate plugin but it works outside of Special Pages (which is where I need it to work) and also manages dates in a custom way that could clash. Making this field editable seems like a lot of sense inside of this plugin, especially as it applies to the news/blog functionality and could also be used to queue posts ahead of time.
Modern UI Admin for GetSimple
Watch the demo. Install this plugin. Use this CSS. Enjoy.
Reply
QuestarDean Wrote:On a side note, I have just replaced:

<?php get_special_field('membername','Default Value',true); ?>

with

<?php get_custom_field('membername','Default Value',true); ?>

and it pulls in correctly.

I am using custom fields plugin too, but even after disabling, and using the first tag above, still get nothing... This will do for the time being. If anyone else comes across and can advise, it would be much appreciated. For now tho, I will be quiet...

Note: Is I18N plug in a necessity for this to work?

Isn't 'membername' similar to the 'user' auto-field in Special Pages?

Code:
<?php get_special_field('user','Anonymous',true); ?>
Modern UI Admin for GetSimple
Watch the demo. Install this plugin. Use this CSS. Enjoy.
Reply
sal Wrote:Any chance of making pubDate an editable field as part of your plugin mvlcek?

I looked at using a separate plugin but it works outside of Special Pages (which is where I need it to work) and also manages dates in a custom way that could clash. Making this field editable seems like a lot of sense inside of this plugin, especially as it applies to the news/blog functionality and could also be used to queue posts ahead of time.
Would this involve making creDate editable as well? It can be a bit tedious having to edit the xml files to fix the dates of older entries. I'm thinking perhaps there should be an option to make certain fields editable or not (so for instance those dates can only be modified on news entries but not other special page types). Also maybe a custom date field too? (Unless using timestamps and outputting with get_special_field_date() counts)

sal Wrote:
QuestarDean Wrote:On a side note, I have just replaced:

<?php get_special_field('membername','Default Value',true); ?>

with

<?php get_custom_field('membername','Default Value',true); ?>

and it pulls in correctly.

I am using custom fields plugin too, but even after disabling, and using the first tag above, still get nothing... This will do for the time being. If anyone else comes across and can advise, it would be much appreciated. For now tho, I will be quiet...

Note: Is I18N plug in a necessity for this to work?

Isn't 'membername' similar to the 'user' auto-field in Special Pages?

Code:
<?php get_special_field('user','Anonymous',true); ?>
I thought 'user' was specific to the user creating/editing the page (and was only displayed in lowercase).
Reply
Thanks for the plugin! Is there a way to make a listing of the pages in a special page?
Reply
pierre Wrote:Thanks for the plugin! Is there a way to make a listing of the pages in a special page?

If you install the I18N Search plugin, you can use it to create nearly any list (using the tags _special_pagetype and _parent_xxx and others). With the parameter component you can display the search result in any way (see here, here and the I18N Search administration in your GS administration for possible search parameters)
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
http://get-simple.info/forum/misc.php?ac...45&preview

anyone has similar problem above with the WYSIWYG for Link to local pages?

thanks!
Reply
tommy Wrote:http://get-simple.info/forum/misc.php?ac...45&preview

anyone has similar problem above with the WYSIWYG for Link to local pages?

thanks!

I think your in the wrong forum.

And that doesn't look like anything Ive seen before in getsimple.
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
shawn_a Wrote:
tommy Wrote:http://get-simple.info/forum/misc.php?ac...45&preview

anyone has similar problem above with the WYSIWYG for Link to local pages?

thanks!

I think your in the wrong forum.

And that doesn't look like anything Ive seen before in getsimple.

no, this is really a screenshot of getsimple 3.1 with Special Pages plugin.

if you use the special pages plugin, create a custom fileds with WYSIWYG, then in the page, click on the Insert/Create Link and you'll see this dialog error for Link to local page.

i found the reference to the drop-down error text - . list_pages_json() . in the file backend.class.php

// modify existing Link dialog
CKEDITOR.on( 'dialogDefinition', function( ev ) {
if ((ev.editor != <?php echo $editorvar; ?>) || (ev.data.name != 'link')) return;

// Overrides definition.
var definition = ev.data.definition;
definition.onFocus = CKEDITOR.tools.override(definition.onFocus, function(original) {
return function() {
original.call(this);
if (this.getValueOf('info', 'linkType') == 'localPage') {
this.getContentElement('info', 'localPage_path').select();
}
};
});

// Overrides linkType definition.
var infoTab = definition.getContents('info');
var content = getById(infoTab.elements, 'linkType');

content.items.unshift(['Link to local page', 'localPage']);
content['default'] = 'localPage';
infoTab.elements.push({
type: 'vbox',
id: 'localPageOptions',
children: [{
type: 'select',
id: 'localPage_path',
label: 'Select page:',
required: true,
items: " . list_pages_json() . ",
setup: function(data) {
if ( data.localPage )
this.setValue( data.localPage );
}
}]
});
content.onChange = CKEDITOR.tools.override(content.onChange, function(original) {
return function() {
original.call(this);
var dialog = this.getDialog();
var element = dialog.getContentElement('info', 'localPageOptions').getElement().getParent().getParent();
if (this.getValue() == 'localPage') {
element.show();
if (<?php echo $editorvar; ?>.config.linkShowTargetTab) {
dialog.showPage('target');
}
var uploadTab = dialog.definition.getContents('upload');
if (uploadTab && !uploadTab.hidden) {
dialog.hidePage('upload');
}
}
else {
element.hide();
}
};
});
content.setup = function(data) {
if (!data.type || (data.type == 'url') && !data.url) {
data.type = 'localPage';
}
else if (data.url && !data.url.protocol && data.url.url) {
if (path) {
data.type = 'localPage';
data.localPage_path = path;
delete data.url;
}
}
this.setValue(data.type);
};
content.commit = function(data) {
data.type = this.getValue();
if (data.type == 'localPage') {
data.type = 'url';
var dialog = this.getDialog();
dialog.setValueOf('info', 'protocol', '');
dialog.setValueOf('info', 'url', dialog.getValueOf('info', 'localPage_path'));
}
};
});
<?php
}
Reply
ohh my bad, i thought this was the default editor.

lol

There is also this error

Uncaught TypeError: Object #<Object> has no method 'select'
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
Anyone have any ideas on how to implement a "menuOrder" order option or similar with I18N Special Pages? If it's not on the upcoming features list I would like to implement this on an existing website ASAP.

Edit: Think I sorted it out myself, (if this makes any sense) in /plugins/i18n_search/searcher.class.php:

Code:
...
275.  private function compare_menuorder($a, $b) {
276.    $r = $a->menuOrder - $b->menuOrder;
277.    return $r != 0 ? $r : strcmp($a->fullId, $b->fullId);
278.  }
279.
280.  private function is_word($line, $word, $ismb) {
...
439.        case 'reversecreated': usort($filteredresults, array($this,'compare_reversecreated')); break;
440.        case 'menuorder': usort($filteredresults, array($this,'compare_menuorder')); break;
441.        case 'score':
...

I would love if your plugins were all on github or bitbucket mvlcek, then we could contribute if you're into that.
Modern UI Admin for GetSimple
Watch the demo. Install this plugin. Use this CSS. Enjoy.
Reply
Not sure why, but i can create a Special Page which saves what tags, page function, page parent etc.

However when i go to "Pages" and then create a new page from a Special Page, it just creates an empty Special Page with no tags, page function, page parent, slug and such.

If i save the page, it puts it under the correct Special Page, but it doesn't have any tags, page function, page parent, slug…

Also, the browse button does not work for me either.

Anyone had this issue?
Reply
I've run into identical problem like QuestarDean.
I'm trying to show a list of special pages using custom rendering component.
I've got a multi line text field named pageintro which content functions as a page's excerpt.
But all I get is default value of <?php get_special_field('pageintro','smack me in the face',true); ?>, and while looking what the heck am I getting in return, it seems that it's a bool(false).
Xml contains the pageintro child along with its content, thus I'm very surprised that get_special_field isn't working.

Is there any solution for that, other than creating own function to get the content of xml's child, or using customfields plugin? I'd love to avoid both ideas.
Addons: blue business theme, Online Visitors, Notepad
Reply
yojoe Wrote:I'm trying to show a list of special pages using custom rendering component.
I've got a multi line text field named pageintro which content functions as a page's excerpt.
But all I get is default value of <?php get_special_field('pageintro','smack me in the face',true); ?>, and while looking what the heck am I getting in return, it seems that it's a bool(false).
Xml contains the pageintro child along with its content, thus I'm very surprised that get_special_field isn't working.

Interesting, it works for me.
Make sure that you use the name (1st column in the settings) of the field, not the label. It is case sensitive and you should best just use lower case letters - no blanks.
The result false means that the default was used - if you want the value itself, use return_special_field.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:Interesting, it works for me.
Make sure that you use the name (1st column in the settings) of the field, not the label. It is case sensitive and you should best just use lower case letters - no blanks.
The result false means that the default was used - if you want the value itself, use return_special_field.

Thanks Martin for hints. The most important was the reason why I was getting false value.
Despite loosing so much time trying to find out, why I was getting errors with alphanumeric names (I dropped using chars like -_ ,even uppercase letters), but it wasn't the cause of problems with rendering. I was just going to edit earlier post, as I have solved the problem recently.
Seems that custom search rendering through a component won't work with special pages.
After I switched to builtin' search result code, and tweaked the output code, results were shown as supposed, along with all custom fields I wanted.

To summarize:
1. cumstomfield's name should consist only of small letters - no other chars
2. custom rendering should be done with special page's search result code - no custom search rendering through component

After solving the main problem, I've run into another.
I'd like to show also a shortened list of special pages in a sidebar. But they should consist only of header, and excerpt (taken from special field). After I invoke search function in template with tag=_special_category items list was rendered with custom search code mentioned earlier.
What would be the best method to get other formatting for a shortened list?
The only way I see now, is to add additional tag to every page (let's say news), and invoke search function with tag=news through ... custom component :\
And all the fun starts again from the beginning.


edit: I've also noticed that special page's are not added to sitemap.
Shouldn't they be ?
Addons: blue business theme, Online Visitors, Notepad
Reply
@yojoe:
I thought that (ascii) upper case letters, _ and - should work for field names, but to be sure lower case ascii characters is your sure bet.

Custom rendering of search results works well with special pages, too, see an example here (bottom of page). If you specify a component, the search HTML/PHP of the special page is ignored. You can easily output any custom/special field in the component (with $item->fieldname), but you probably would need a lot of ifs to display these fields only if relevant/existing.

Regarding the sitemap: I think there is a problem with I18N and the sitemap in GS 3.1.2, but I need to investigate.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
mvlcek Wrote:@yojoe:
I thought that (ascii) upper case letters, _ and - should work for field names, but to be sure lower case ascii characters is your sure bet.
Yeah, one should better stay with proven method Smile

Quote:Custom rendering of search results works well with special pages, too, see an example here (bottom of page). If you specify a component, the search HTML/PHP of the special page is ignored. You can easily output any custom/special field in the component (with $item->fieldname), but you probably would need a lot of ifs to display these fields only if relevant/existing.
Afair in one of approaches I had to whole problem I tried refering to xml's child directly, but considering all other cases and settings I had to bear with, I could miss something.
I have to try with it again.
As for now, the best approach I found, is to show all possible fields and just hide them with css.

I only wish special pages allowed to translate the page directly in all special pages view, without the need to seek them on i18n pages lists. But that would be just a nod to UX.

Quote:Regarding the sitemap: I think there is a problem with I18N and the sitemap in GS 3.1.2, but I need to investigate.
I tested everything on 3.1.2 available on g.code, with current versions of your plugins.
In one of your replies you have mentioned that you invoke sitemap function upon page save, but I don't know how to find out how is the workflow going when no errors appear.
Addons: blue business theme, Online Visitors, Notepad
Reply
yojoe Wrote:I only wish special pages allowed to translate the page directly in all special pages view, without the need to seek them on i18n pages lists. But that would be just a nod to UX.

I don't understand, you can add other language versions directly on the view special pages view - see languages EN/DE and + icons in attached screenshot.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
Now I'm really confused. I didn't have a column with additional language, as shown on attached sshot, altough I had eng lang as a second language.
Hopefully reuploading all i18n plugins, clearing cache and resaving all plugin settings solved the problem.

Seems that it isn't my best day for playing with GS.
Addons: blue business theme, Online Visitors, Notepad
Reply




Users browsing this thread: 1 Guest(s)