GetSimple Support Forum
I18N Special Pages - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Plugins (http://get-simple.info/forums/forumdisplay.php?fid=13)
+--- Thread: I18N Special Pages (/showthread.php?tid=2747)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22


RE: I18N Special Pages - Angryboy - 2013-05-22

Not unless you say please. :-P

The problem is because of the urlencode() function applied on each tag. It does what it is supposed to do, but in the case of our tags we don't want spaces to be replaced with '+'. You can patch this (till perhaps mvlcek does his own more elegant workaround in his usual fashion) by going to plugins/i18n_specialpages/specialpages.class.php and replacing:

Code:
$url .= '?tags='.urlencode($tag).(!$all && $type ? ' _special_'.urlencode($type) : '');

On line 179 with:

Code:
$url .= '?tags='.str_replace('+', '_', urlencode($tag)).(!$all && $type ? ' _special_'.urlencode($type) : '');



RE: I18N Special Pages - Oleg06 - 2013-05-22

Martin probably just busy, I'm glad you agreed to help me.This works.


RE: I18N Special Pages - mvlcek - 2013-05-22

(2013-05-21, 03:00:55)Oleg06 Wrote: вторая+новость
before it would be so
вторая_новость
it works
http://business-website.ru/pandus/search/?tags=первая
it does not work
http://business-website.ru/pandus/search/?tags=вторая+новость
it works
http://business-website.ru/pandus/search/?tags=третья_новость
it works
http://business-website.ru/pandus/search/?words=Классы+для+тегов&search=Поиск

I think that the problem is how I18N Search handles tags: it replaces non-letter characters with _. It might be that it handles a tag search request with a space as searching for two tags and thus doesn't find anything. I'll have a look at it, but it will probably be on the weekend earliest.


RE: I18N Special Pages - Oleg06 - 2013-05-22

are all working Smile


RE: I18N Special Pages - Angryboy - 2013-06-26

Making an inquiry here.

Draxeiro asked about displaying the contents of the dropdown options defined in a special field (for example, if one wanted to show a list of categories from the dropdown). As it stands, there is no function that allows one to pull that data easily. I gave Draxiero a slap-dash solution that does that, but I wondered if perhaps such a function could be written into Special Pages that would easily allow users to get such aspects of the page's schema returned to them for further parsing.

Example:
PHP Code:
function return_i18n_special_page_properties($page$field=null) {
  
$xml getXML(GSDATAOTHERPATH.'i18n_special_'.$page.'.xml');
  if (
$xml && !$field) {
    return 
json_decode(json_encode($xml), true);
  }
  elseif (
$xml && $field) {
    
$fields json_decode(json_encode($xml->fields), true);
    foreach (
$fields['item'] as $f) {
      if (
$f['name']==$field) return $f;
    }
  }
  else return 
false;


Then if someone wanted to get an array of the dropdown list showing their categories (e.g. the field name is 'category'), they can do so with the following (the example special page is 'blog'):

PHP Code:
$categories return_i18n_special_page_properties('blog''category');
foreach (
$categories['option'] as $category) {
  
// output category, e.g. echo '<li>'.$category.'</li>';




RE: I18N Special Pages - 0zz - 2013-07-21

I'm trying to set up news management (multilanguage) with SpecialPages plugin.
So, in my "Company News" SpecialPageType setup, I use the following code in the "view" tab:
Code:
<h2><?php get_special_field('title','',false); ?></h2>
<p class="small"><?php get_special_field_date('pubDate', $dateFormat); ?></p>
<?php get_special_field('content'); ?>

And this one in the "search" tab field:

Code:
<?php if ($showDate) { ?>
<p class="small">
  <?php get_special_field_date('creDate', $dateFormat); ?>
</p>
<?php } ?>
  <?php get_special_field_excerpt('content', $numWords); ?>
   <p class="link-full"><a href="<?php get_special_field('link','',false); ?>">
    <?php echo "Read more..."; ?>
  </a></p>

The last function is called by a string in the page where I want to show recent news list without headings:
Code:
(% searchresults tags:compnews max:4 i18n:0 lang:en DATE_FORMAT:"%d/%m/%Y" order:created showPaging:0 numWords:1p HEADER="" %)

Now i just have to create special pages section and add translations via ViewAllPagesIl8N menu if required..
Everything seems to be fine, but I'm not sure if this is the correct way of using this plugin..

How can I change the way the DateFormat is shown on the full news page? I want it to be the same as in a recent news list ("%d/%m/%Y"). Please help!


RE: I18N Special Pages - mvlcek - 2013-07-21

(2013-07-21, 01:43:38)0zz Wrote: How can I change the way the DateFormat is shown on the full news page? I want it to be the same as in a recent news list ("%d/%m/%Y"). Please help!

<?php get_special_field_date('pubDate', "%d/%m/%Y"); ?>


RE: I18N Special Pages - 0zz - 2013-07-21

(2013-07-21, 01:55:58)mvlcek Wrote: <?php get_special_field_date('pubDate', "%d/%m/%Y"); ?>
So fast and... easy! )) Thank you, this works!

Also, I have created am additional text field named "Department" with this plugin. How can I get it's value in a page?

get_custom_field(Deparment) doesn't work properly..


RE: I18N Special Pages - 0zz - 2013-07-21

Just an update:
I've also installed Custom Fields Plugin and tried to call created field "DepartmentCustom" in my code here:
<h2><?php get_special_field('title','',false); ?></h2>
<p class="small"><?php get_custom_field(DepartmentCustom); ?></p>
<?php get_special_field('content'); ?>

But it just doesn't show anything (although this field contains data in the relevant pages.


RE: I18N Special Pages - mvlcek - 2013-07-21

(2013-07-21, 02:46:42)0zz Wrote: Just an update:
I've also installed Custom Fields Plugin and tried to call created field "DepartmentCustom" in my code here:
<h2><?php get_special_field('title','',false); ?></h2>
<p class="small"><?php get_custom_field(DepartmentCustom); ?></p>
<?php get_special_field('content'); ?>

But it just doesn't show anything (although this field contains data in the relevant pages.

get_custom_field('DepartmentCustom');


RE: I18N Special Pages - 0zz - 2013-07-21

(2013-07-21, 02:51:40)mvlcek Wrote: get_custom_field('DepartmentCustom');

Yep, sorry, I used just exactly as you suggested (missed the quotation marks in my code above).
And still get empty results.. In fact I'm editing the pages which have already been created, before installing CustomFields Plugin, but this shouldn't be a problem, I guess..


RE: I18N Special Pages - mvlcek - 2013-07-21

(2013-07-21, 03:02:26)0zz Wrote: Yep, sorry, I used just exactly as you suggested (missed the quotation marks in my code above).
And still get empty results.. In fact I'm editing the pages which have already been created, before installing CustomFields Plugin, but this shouldn't be a problem, I guess..

Try with get_special_field instead of get_custom_field.


RE: I18N Special Pages - 0zz - 2013-07-21

Hello, tried that code too. Still get empty results.
I have the last version of GS and last versions of all your wonderful plugins.
My site is in Russian (cyrillic) and the information in the custom/special fields contains russian text.
I've tried editing previously (before installing plugins) created pages and created new pages via Create New Specail Page.

Still, the field return empty. Here is the link: www.igilik.uz

Thank you for your help!


RE: I18N Special Pages - 0zz - 2013-07-22

Still trying to set up news with categories via SP plugin.
So, I've created two SP types (Company News and Country News)

I create news by adding special pages into relevant SP type (I use them as news categories)

And I call the news to the front page with the codes mentioned above. In both categories they are the same. But for some reason in the Country News the template which is set up in the "search" tab of SP settings does not work. And I see the default template instead ((

Besides, the special fields do not show up at all Confused My idea was to include news source for Country News with this field.

What am I doing wrong? Thank you!


RE: I18N Special Pages - 0zz - 2013-07-23

I'm sorry, I still keep experimenting. Now I try get the recent news via component "First_Page". Here is it's code:
Code:
<div class="col1">
    <h2 class="heading">COMPANY NEWS</h2>
    <div class="news-anons">
<?php get_i18n_search_results(array('tags'=>'compnewsrus','lang'=>ru, 'max'=>4,'numWords'=>1p,'HEADER'=>null)); ?>
    </div>
</div>

<div class="col2">
    <div class="uzex-rates">
        <h2 class="uzex-heading">RATES</h2>
        <?php get_i18n_content('uzexratespage'); ?>
        <div class="banner">
            <a href="http://bank.uz/currency/cb.html" title="Bank.uz - все о банках Узбекистана" target="_blank"><img src="http://bank.uz/scripts/informer" border="0"/></a>
        </div>
    </div>
</div>

<div class="col3">
    <h2 class="heading">COUNTRY NEWS</h2>
    <div class="news-anons">
<?php get_i18n_search_results(array('tags'=>'uzbnews','lang'=>ru, 'max'=>4,'numWords'=>1p,'HEADER'=>null)); ?>
    </div>
</div>

Now this compoment doesn't work at all. Just shows nothing.. Though, when I place simple text instead of this code - it does show up. Please, help me! )) Thank you!


RE: I18N Special Pages - 0zz - 2013-07-23

upd. I got it working by correcting code to:
Code:
<?php get_i18n_search_results(array('tags'=>'compnews','max'=>4,'numWords'=>'1p','HEADER'=>null)); ?>

and relevantly called "uzbnews"

However still have the default templates showing country news. How can I manage it??
And I miss the detailed information on the way of setting up news calling function.. What other argumenst could be put into
<?php get_i18n_search_results(array('...)); ?>
Like "Lang" "Dateformat"?? What should be the order of these arguments in the array. Please, give examples..

Thank you!


RE: I18N Special Pages - Oleg06 - 2013-07-23

I have offered you change the tag on my forum, but apparently none is a prophet in his own country


RE: I18N Special Pages - mvlcek - 2013-07-24

(2013-07-21, 14:20:00)0zz Wrote: Hello, tried that code too. Still get empty results.
I have the last version of GS and last versions of all your wonderful plugins.
My site is in Russian (cyrillic) and the information in the custom/special fields contains russian text.
I've tried editing previously (before installing plugins) created pages and created new pages via Create New Specail Page.

Still, the field return empty. Here is the link: www.igilik.uz

Thank you for your help!

I was just reading another thread, which reminded me that field names are converted to lower case
- my description of the I18N Custom Fields plugin even mentions you should only use lower case field names ;-)

So it should be get_custom_field('departmentcustom'); or get_special_field('DepartmentCustom');


RE: I18N Special Pages - 0zz - 2013-07-24

Yes! I wish I could shake your hand!! ))

In fact, I did notice that "lower case" mention in CustomField plugin's manual, but did not realize it has to to with special fields too..

Still, could you please give more information about this search string:
Code:
<?php get_i18n_search_results(array('tags'=>'compnews','max'=>4,'numWords'=>'1p','HEADER'=>null)); ?>
like what parameters and in which order could be used?
in particular I am interested in selecting news of certain language, allowing HTML in special fields (my "source" spec.field may contain link to the website) and may be other..

Thanks a lot!


RE: I18N Special Pages - mvlcek - 2013-07-24

(2013-07-24, 02:44:19)0zz Wrote: In fact, I did notice that "lower case" mention in CustomField plugin's manual, but did not realize it has to to with special fields too..

I added a note to the special pages description, too.

(2013-07-24, 02:44:19)0zz Wrote: Still, could you please give more information about this search string:
Code:
<?php get_i18n_search_results(array('tags'=>'compnews','max'=>4,'numWords'=>'1p','HEADER'=>null)); ?>
like what parameters and in which order could be used?
in particular I am interested in selecting news of certain language, allowing HTML in special fields (my "source" spec.field may contain link to the website) and may be other..

For the parameters see the usage tab of I18N Search settings in the GetSimple administration.
numWords can also contain specifier characters, e.g. 15 (15 words), 200c (200 characters[/i], 1p (1 paragraph), 1pm (1 paragraph and more indicator ...).
The order is irrelevant.

For all german news use 'lang'=>'de'.
If you select WYSIWYG as field type, the user will use the CKEditor to enter HTML. You can display such a field like the others with get_special_field(...). If you specify a third parameter (optional), it must be true for HTML fields.


RE: I18N Special Pages - 0zz - 2013-07-24

omg! it's working!!! )) thank you once more! And sorry for the noob's questions!


RE: I18N Special Pages - nnk - 2013-07-30

Hello everybody !
I'm new to GS and trying to figure out all the possibilities.

While doing a test run with this plugin I've bee trying to customize the "summary page", but it seems there's no way to do it...even using i18n search for results.

Maybe it's there and somebody can help me find it...
but if I'm right please consider adding this feature !
It's crucial for many custom blogs/listings/news...

Ideally some "HTML/PHP code for the display of a summary page" may be added to Configure Special Pages->View !

Thank you for now Wink


RE: I18N Special Pages - Angryboy - 2013-07-30

What do you mean by the summary page? The page that displays the results? You can customize it using conditionals:

PHP Code:
if (return_page_slug() == 'summaryPageSlug') {
  
// custom output


Or create a separate template file for it and select that template when editing the page's options. I assume that there isn't a 'summary page template' because the nature of i18n search is that it can be called on any page; so depending on the type of special page that you want, there may be any number of 'summary' pages (or even none).

(Unless I've misunderstood?)


RE: I18N Special Pages - nnk - 2013-07-30

Thank you Angryboy...this was a great hint and I found everything I needed to add customization in the Configure I18N special pages->Search tab !!!


RE: I18N Special Pages - blackeye - 2013-07-30

Hi to everybody, especially to mvlcek!

I'm using Special Pages plugin for news and I wonder, if there is a way how to create a field with a properties of a date. I need to have this date field editable by client, so I can't use creDate or pubDate.
And since I need to sort my news by this field, ordinary text field won't do the job correctly.

Thanks in advance