Posts: 2,094
Threads: 54
Joined: Jan 2011
2012-02-12, 07:21:42
(This post was last modified: 2012-11-03, 05:36:23 by mvlcek.)
The I18N Special Pages plugin allows you to define types of pages with custom fields, customized behaviour and customized display.
Together with the I18N Search plugin you can create (fully searchable)
- News
- Blogs
- Product lists or lists of other items
Features:
- define custom fields (including default values) per page type
- define default values for slug, parent, etc.
- define a default content, e.g. to provide a standard layout of a product description
- define directly, how the page should be displayed, instead of using a template
- customize, how the page shall be displayed as search result
- sample page type templates included - page type definitions can be easily shared
- stores creation date (field 'creDate') and user in pages
INSTALLATION
Download the plugin from here and unzip it to the plugins directory of your GetSimple installation.
(Make sure you unzip/copy all files including the .htaccess files, which might be hidden on your computer)
For an optimum experience you should also install
(use the latest versions)
USAGE
Go to the Plugins/Configure I18N Special Pages of your GetSimple administration and configure your special pages. You can start by using one of the supplied templates or download one of the templates supplied by other users.
- you can set some default values for new pages,
- you can add custom fields and set default values for them and the content of the page. You can define which fields are indexed by I18N Search (if installed),
- you can define how to display the page together with its custom fields,
- you can define how to display the page as part of a search result (if you have I18N Search installed).
Once you have finished defining a special page type, you can create a page of this type by going to Pages/Create new Special Page.
You can list special pages either with all other pages in Pages/View all Pages or in Pages/View all Special Pages.
Using additional fields:
Use the following functions in your template or in the view/search tabs of the special page configuration:
Code: get_special_field($name, $default='', $isHTML=true)
return_special_field($name, $default='')
get_special_field_date($name, $format=null)
return_special_field_date($name, $format=null)
If you set $isHTML to false, special characters are encoded (with htmlspecialchars()).
For $format see the PHP function strftime.
With I18N Search installed:
All content and all custom fields that are enabled for indexing, will be searched with a normal search.
To search for special pages, e.g. products, create a page with:
Code: (% searchform addtags=_special_product %)
(% searchresults addtags=_special_product %)
You can also use the following functions in your template or search tab of the special page configuration:
Code: get_special_field_excerpt($name, $length)
return_special_field_excerpt($name, $length)
$length can be a positive number for the number of words or a positive number followed by 'p' or 'pm' for the number of paragraphs (pm: add a <p>...</p> if there is more) or a negative number for the whole content.
Posts: 89
Threads: 6
Joined: Mar 2011
This is great. However, one suggestion after testing it out would be: for a blog page type, having all of the blog posts listed on the standard I18N view all pages seems to be counterproductive as a blog with let's say 100 posts would start to get really long. It makes sense to list the blog posts under view special pages > blog.
Todo arde si le aplicas la chispa adecuada.
Posts: 6,266
Threads: 181
Joined: Sep 2011
Doesn't fail gracefully if i8n_common is missing.
500 error.
Have to install search.
Posts: 17
Threads: 3
Joined: Dec 2011
Added some content to "Set default page content..." , and the content did not show up in the new special page. Tags & Keywords field did show loaded content in the new special page.
Posts: 2,094
Threads: 54
Joined: Jan 2011
2012-02-12, 17:59:03
(This post was last modified: 2012-02-12, 17:59:21 by nime.)
@KBear and @shawn_a: Corrected in I18N Special Pages version 0.7.1.
Thanks for testing!
Posts: 2,094
Threads: 54
Joined: Jan 2011
yurifanboy Wrote:This is great. However, one suggestion after testing it out would be: for a blog page type, having all of the blog posts listed on the standard I18N view all pages seems to be counterproductive as a blog with let's say 100 posts would start to get really long. It makes sense to list the blog posts under view special pages > blog.
Yes, I know.
There are some disadvantages of having news or blog entries as pages.
However, the plugin llists the blog posts under View all Special Pages/Blog and if you have all blog posts under one parent and use the hierarchical view of the pages view of the I18N plugin, you can close this parent and save your settings. Then you won't see the blog posts in the pages view.
That's the reason I recommend to also install the I18N plugin.
Posts: 15
Threads: 2
Joined: Oct 2010
I'm probably missing something very obvious out, but I cannot figure out how to insert the custom fields into my template. Using the method from the I18N Custom Fields plugin doesnt seem to work (i.e. <?php get_custom_field('nameofthefield'); ?> )
Posts: 2,094
Threads: 54
Joined: Jan 2011
jkob Wrote:I'm probably missing something very obvious out, but I cannot figure out how to insert the custom fields into my template. Using the method from the I18N Custom Fields plugin doesnt seem to work (i.e. <?php get_custom_field('nameofthefield'); ?> )
I have updated the description in the first post of this thread and on my web site: get_special_field, return_special_field, etc.
Posts: 15
Threads: 2
Joined: Oct 2010
Thank you for a very quick reply
Still cant get it to work - it will output $default if I add something to that, but not $name. $name is just the name of the field, right? I dont have to use the name of the Special Page Type for anything?
Posts: 2,094
Threads: 54
Joined: Jan 2011
jkob Wrote:Thank you for a very quick reply
Still cant get it to work - it will output $default if I add something to that, but not $name. $name is just the name of the field, right? I dont have to use the name of the Special Page Type for anything?
Yes. E.g. if you have a field named myfield, you can use
Code: <?php get_special_field('myfield'); ?>
If you create a page type from the template software, you can see examples on the "view" tab.
Posts: 15
Threads: 2
Joined: Oct 2010
Aaaahh great! It works now - my mistake was to add <?php get_special_field('myfield'); ?> directly in the template.php file, when I used the View tab instead it worked.
Fantastic plugin, thank you
Posts: 2,094
Threads: 54
Joined: Jan 2011
jkob Wrote:Aaaahh great! It works now - my mistake was to add <?php get_special_field('myfield'); ?> directly in the template.php file, when I used the View tab instead it worked.
Fantastic plugin, thank you
Fine that it works for you now. But it should also work directly in the template, if the current page is a "special" page with this field set.
Posts: 17
Threads: 3
Joined: Dec 2011
mvlcek Wrote:...Thanks for testing!
Thanks also, loads a preformated layout well.
I'm also confused with the "input fields" and what to do with them.
Posts: 2,094
Threads: 54
Joined: Jan 2011
KBear Wrote:I'm also confused with the "input fields" and what to do with them.
The fields are additional input fields, when editing a page, so that you can enter your information in a structured way. You will see them when you click on "Page Options", when you create/edit a page.
Posts: 346
Threads: 27
Joined: Sep 2010
2012-02-17, 06:44:35
(This post was last modified: 2012-02-17, 07:19:04 by logonsf.)
I am terribly excited about this plugin, because it is the final nail that your news plugin needs to be flawless (since this eliminates some of the manual labour that may put off new users).
I don't see a problem with it at the moment, so I only have one question. Is there a way that I can migrate my current news pages into this format? I have a great number of pages that I've spent hours correcting dates and times for and I'd hate to lose all of the time formatting I've needed to do.
Is the only way of doing so to remake the pages under 'Special Pages' and edit the xml files on the back-end to fix the 'date created' and 'published' dates?
---edit---
just realised that I didn't make the nature of my news pages clear - they are just regular pages with utilising custom fields, all viewed through your search plugin.
---edit #2---
Figured out how to do it. For anyone who needs to...
Using the file manager of your web provider, open the .xml file of the page that you wish to change from 'regular' to 'special'. Find the following:
And insert after it:
Code: [CDATA[_special_SPECIALNAMETYPE, SPECIALNAMETYPE]]
Where SPECIALNAMETYPE is the name of the type of the special page you've created, e.g. news. It should now read:
Code: <meta>[CDATA[_special_SPECIALNAMETYPE, SPECIALNAMETYPE]]
Then find:
and paste after it:
Code: <special>SPECIALNAMETYPE</special>
So that it reads:
Code: </meta><special>SPECIALNAMETYPE</special>
Where SPECIALNAMETYPE means what was previously said. Save the xml file and it should now be a Special page. Finally, edit the page in GetSimple, find the meta tags and delete the one with the square brackets on it and resave the page. Everything should then be sorted. It may be a lengthy manual process for those with many news items or articles, but that's all that's needed to make an already existing page 'special'.
Posts: 2,094
Threads: 54
Joined: Jan 2011
2012-02-17, 07:42:16
(This post was last modified: 2012-02-17, 07:44:32 by nime.)
Just wantet to answer, but you were faster :-)
Some comments: - what's really needed is the <special>NAME</special> (where NAME is the name of the special page type) - it is how the plugin recognizes, if it is a special page
- regarding the tags (meta): You don't have to add anything, if you can already identify your (now special) pages, e.g. you have a common tag for them. If you don't add the _special_NAME it it will be added the next time you save the page. It is only added for your convenience to have a unique tag for I18N Search.
If you edit the meta tag, it should read <meta>_special_NAME, ...</meta> or <meta><![CDATA[_special_NAME, ...]]></meta>.
And you should remove your custom fields from the I18N Custom Fields plugin and add them to the special page type.
Posts: 2,094
Threads: 54
Joined: Jan 2011
I18N Special Pages version 0.7.2: - corrects adding a page in another language (if used with I18N plugin)
- adds "Create page" links to "View Special Pages".
Posts: 346
Threads: 27
Joined: Sep 2010
Thanks for the speedy reply I shall definitely do that and update everything on my site. This calls for a Version 3 for the news plugin tutorial y'know :-P
Stay awesome, mvlcek.
Posts: 110
Threads: 3
Joined: Sep 2010
I'm very excited about this plugin; this will solve many issues with custom content display;
i have one question regarding the URLs; is there any way to be able to control the page slug for special pages?
I installed the first version and noticed that the page slugs had to have a date suffix; but if i were creating something like a discography, it would be better to have a custom pages slug...
and also i wanted to check to see about displaying an image field on the results page....
thanks,
marc
Posts: 2,094
Threads: 54
Joined: Jan 2011
alienee2 Wrote:I installed the first version and noticed that the page slugs had to have a date suffix; but if i were creating something like a discography, it would be better to have a custom pages slug...
They don't have to: "Here you can enter a ..."
Just leave the slug field empty in the configuration and set it when you create the page.
Posts: 346
Threads: 27
Joined: Sep 2010
2012-02-17, 16:55:19
(This post was last modified: 2012-02-17, 18:28:55 by logonsf.)
On the configuration of the discography's special page (Plugins -> Configure I18N Special Pages -> discography), simply delete what is in the Slug/URL field completely and save. Thereafter, when you create and edit special pages under discography, you'll be asked to define the Slug/URL yourself, as with any normal page.
It looks like the only possible fault with this plugin is that you can't have a combination of the pre-defined prefix/suffix and your own custom slugs. It's either all predefined or all custom. Some might like it so that the field can take a form similar to the following:
Code: news-%Y-%m-%d-{pageslug}
And page slug is the name that they define themselves. That way they can have the date always pre-defined, but ensure that the full slug always includes any additional titles that they may want, e.g:
Code: news-2012-02-17-i18n-special-pages-update
Or in alienee2's case:
Where the custom slug includes the artist's name, year and album, leading to
Code: 2012-02-17-artist-year-album
Or something.
--edit-- took too long editing my post to see that mvlcek had posted already xD
--edit-- My news items aren't showing:
http://spritingonawhim.net.tc/blog/
On that page I have
Code: (% searchresults addtags=_special_news %)
So is there something I am missing?
--edit-- fixed it by changing addtags to just tags.
Posts: 346
Threads: 27
Joined: Sep 2010
Besides ticking 'INDEX', is there anything else that is needed for a special field to be indexed by a regular search? I can't seem to get my special pages to index any special fields. I ask this because I'm writing up the tutorial now and there is a certain feature that I want to show that necessitates said fields being searchable.
Posts: 2,094
Threads: 54
Joined: Jan 2011
2012-02-18, 22:05:25
(This post was last modified: 2012-02-18, 22:16:41 by nime.)
I18N Special Pages version 0.7.3: - fixes a typo preventing the indexing of custom fields
- deletes the I18N Search index on saving a special page type (if I18N Search is installed) (@Angryboy)
Edit: if you downloaded this version before this edit, redownload it.
Posts: 346
Threads: 27
Joined: Sep 2010
Working fine (tested in GS 3.1). Thanks again for the quick and efficient response. :-)
Posts: 2,094
Threads: 54
Joined: Jan 2011
I18N Special Pages version 0.7.4: - some cosmetic improvements displaying the special fields on the page edit page
|