Thread Rating:
  • 3 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I18N Special Pages
If you don't mind a rather makeshift solution, you can modify Special Pages to allow for DateTime-Local input fields (assuming that you use Google Chrome, Safari or Opera).

How-to
- Edit the file i18n_specialpages/conf_edit.php - go to line 565, which should have:
PHP Code:
<option value="textfull" <?php echo @$def['type']=='textfull' 'selected="selected"' ''?> ><?php i18n('i18n_specialpages/LONG_TEXT_FIELD'); ?></option> 

And replace it with the following:

PHP Code:
<option value="textfull" <?php echo @$def['type']=='textfull' 'selected="selected"' ''?> ><?php i18n('i18n_specialpages/LONG_TEXT_FIELD'); ?></option>
<option value="date" <?php echo @$def['type']=='date' 'selected="selected"' ''?> >Date</option> 

- Save, then go to i18n_specialpages/edit.php and go to line 53 and replace:

PHP Code:
            case 'textfull'// draw a full width TextBox
                  
echo '<td colspan="2"><b>'.$label.':</b><br />';
                  echo 
'<input class="text" type="text" style="width:602px;" id="post-sp-'.$key.'" name="post-sp-'.$key.'" value="'.$value.'" /></td>'
          
$col += 2;
                break; 

With:

PHP Code:
case 'textfull'// draw a full width TextBox
                  
echo '<td colspan="2"><b>'.$label.':</b><br />';
                  echo 
'<input class="text" type="text" style="width:602px;" id="post-sp-'.$key.'" name="post-sp-'.$key.'" value="'.$value.'" /></td>'
          
$col += 2;
                break; 
              case 
'date':
                  echo 
'<td><b>'.$label.':</b><br />';
                  echo 
'<input class="datetime-local" type="datetime-local" style="width:295px" id="post-sp-'.$key.'" name="post-sp-'.$key.'" value="'.$value.'" /></td>'
                
$col++;
          break; 

And save.

Result (for a special field with the newly created 'date' type and label 'Date')

[Image: 2v8jok7.png]

You would still need to format the output (if you are displaying it on the page) using php functions though (namely strtotime to make it a UNIX timestamp and date to do the formatting).

I should make it clear that this is a hack more than anything (and not a rigorously tested one), and is really here as an example/model for further refinement (ideally by the plugin author).
Reply
(2013-07-30, 08:46:31)blackeye Wrote: 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.

You may use pubDate, with the (very simple) pubDateFix plugin.
Reply
(2013-07-30, 16:07:28)Carlos Wrote:
(2013-07-30, 08:46:31)blackeye Wrote: 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.

You may use pubDate, with the (very simple) pubDateFix plugin.

Excelent!
This is exactly what I was looking for.
The only thing that bothers me now is, that it shows editable date on all the pages, not exclusively on special news pages. But I can live with it for now. Smile
Thanks
Reply
Hello everybody!
Two questions:

1. Any suggestion to rearrange special pages ? I tried dragging them in Navigation structure, then saved. But they're unarranged in frontend !

2. Is possible to customize the slug of special pages with the page title too...or only strftime functions are allowed?

Thank you in advance ;-)
Reply
1 - If you want to arrange by menu order, set the order parameter to menuOrder (+menuOrder for ascending, -menuOrder for descending).

2 - Leave the "Custom URL (Slug)" field empty in that special page's settings to have custom slugs for each page. If you are definiting the slugs yourself, then chances are they'll be unique enough not to need timestamps to be distinguished from each other. There currently isn't an option to have both a dynamically generated timestamp and a custom slug.
Reply
(2013-08-01, 01:27:15)Angryboy Wrote: 1 - If you want to arrange by menu order, set the order parameter to menuOrder (+menuOrder for ascending, -menuOrder for descending).

that looks good, but doesn't work for me, but I use php function to list it

$results = return_i18n_search_results($tags="_special_".$args[0], $order=null);

what should I change please ?
Reply
PHP Code:
$results return_i18n_search_results($tags="_special_".$args[0], $words=null$first=0$max=10$order='+menuOrder'$lang=null); 
Reply
(2013-08-01, 03:11:21)Angryboy Wrote:
PHP Code:
$results return_i18n_search_results($tags="_special_".$args[0], $words=null$first=0$max=10$order='+menuOrder'$lang=null); 

Thank you very much for answering questions about my plugins, @Angryboy :-)

FYI: The function definitions on my web site are copied directly from the code and specify parameter names (and default values). When calling the functions, only the order of the parameters is relevant. Using $xxx= is not necessary and might even cause problems in your template, if you use a variable $xxx in your template.

Just call the function with:
PHP Code:
$results return_i18n_search_results("_special_".$args[0], null010'+menuOrder'); 
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
(2013-08-01, 03:51:07)mvlcek Wrote:
(2013-08-01, 03:11:21)Angryboy Wrote:
PHP Code:
$results return_i18n_search_results($tags="_special_".$args[0], $words=null$first=0$max=10$order='+menuOrder'$lang=null); 

Thank you very much for answering questions about my plugins, @Angryboy :-)

FYI: The function definitions on my web site are copied directly from the code and specify parameter names (and default values). When calling the functions, only the order of the parameters is relevant. Using $xxx= is not necessary and might even cause problems in your template, if you use a variable $xxx in your template.

Just call the function with:
PHP Code:
$results return_i18n_search_results("_special_".$args[0], null010'+menuOrder'); 

No problem. Just keeping being awesome.

(On the parameter point: understood; the variables were kept in there for clarity and laziness in order to save explaining what each individual parameter is)
Reply
guys, I swear that '+menuOrder' was only thing that I didn't try Big Grin

of course it's working perfectly, thanks Smile
Reply
is it possible to do something to not display a tag <li> with empty fields?
Code:
<ul class="slides">
        <li>
            <?php get_special_field_image('gall1', 'Belle Decor', '770', '302'); ?>
        </li>
<?php if (defined('gall2')) { ?>
        <li>
            <?php get_special_field_image('gall2', 'Belle Decor', '770', '302'); ?>
        </li>
<?php } ?>
<?php if (defined('gall3')) { ?>
        <li>
            <?php get_special_field_image('gall3', 'Belle Decor', '770', '302'); ?>
        </li>
<?php } ?>
<?php if (defined('gall4')) { ?>
        <li>
            <?php get_special_field_image('gall4', 'Belle Decor', '770', '302'); ?>
        </li>
<?php } ?>
    </ul>
Reply
PHP Code:
<?php $slides = array('gall1''gall2''gall3''gall4'); ?>

<ul class="slides">
  <?php foreach ($slides as $slide) { ?>
    <?php if (!empty(return_special_field($slide))) { ?>
      <li>
        <?php get_special_field_image($slide'Belle Decor''770''302'); ?>
      </li>
    <?php ?>
  <?php ?>
</ul> 

The above takes the slide names as an array, then loops through each name, only outputting the <li> tags if the special field with that name isn't empty. You can add as many gallery names to the array as you want (assuming that the special field for it is filled).
Reply
reason does not work
Reply
Try changing
Code:
(!empty(return_special_field($slide)))
by
Code:
(return_special_field($slide))
Reply
And if that doesn't work, try
Code:
(return_special_field($slide) != '')
Reply
Big, big Russian SPASIBO Smile
Reply
is it possible to attach "a multiline text field" counter?
so that the user did not enter a little more than the number of characters
Code:
Meta Description: 155 characters remaining
Reply
   

Wondering if I can have two instances of special pages being pulled into a page?

I have a page that will have a 4 column layout. I want to have one column with news items 1-4 and the next column with items 4-8 for example.

If yes, how would I write this?

I am using the code below in another installation of GS and I'm not sure how to or even *IF* I could get the code to pull in the first few items and then continue the next items in the second column. Similar to a newspaper layout.

(% searchresults tags:news numWords:25 order:reverseurl %)

Thank you for any help you can offer.
Reply
Controlling Sort Order

I'm wondering if I might be able to control the sort order or display of special pages and how if I am not wanting to use alpha or chronological order?

I have a special page set up that is a board of director member page with a photo and contact details. I need to list the pages in order of importance-President first, VP next, Secretary next, etc. when pulling them into the display page.

Could I add some kind of field or tag to a page to assign importance and control the sort order that way?

Thank you for any help you can provide.
Reply
(2013-08-22, 14:08:31)sarnaiz Wrote: Controlling Sort Order

I'm wondering if I might be able to control the sort order or display of special pages and how if I am not wanting to use alpha or chronological order?

I have a special page set up that is a board of director member page with a photo and contact details. I need to list the pages in order of importance-President first, VP next, Secretary next, etc. when pulling them into the display page.

Could I add some kind of field or tag to a page to assign importance and control the sort order that way?

Thank you for any help you can provide.

After reading through some of the posts here I'm thinking menu order is what I was looking for to control the sort order.
Reply
Hi all,

Apologies if this is answered somewhere else just that I can't find it.

I have created a website using Special Pages to create news items. The site itself is in English and Russian, the english side seems to work fine, however, on the russian side news articles show in both english and russian on the home page. So the question is how can I resolve this?

The site is : www.stuffid.com

Many thanks for any help.
Reply
(2013-09-16, 21:28:53)srsdesign Wrote: I have created a website using Special Pages to create news items. The site itself is in English and Russian, the english side seems to work fine, however, on the russian side news articles show in both english and russian on the home page. So the question is how can I resolve this?

Use (% searchresults ... lang=ru %)
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
(2013-09-16, 21:50:22)mvlcek Wrote:
(2013-09-16, 21:28:53)srsdesign Wrote: I have created a website using Special Pages to create news items. The site itself is in English and Russian, the english side seems to work fine, however, on the russian side news articles show in both english and russian on the home page. So the question is how can I resolve this?

Use (% searchresults ... lang=ru %)

Many thanks for the prompt reply, please excuse my ignorance!

I am using the View tab in the special pages so under the ru tab my code looks like this:

<div id="left_col">
<?php get_page_content(); ?>
</div>
<div id="mid_col">
<?php get_special_field('projectimg'); ?>
</div>
<div id="right_col">
<h3>latest news...</h3>
<?php get_i18n_search_results(['tags' => '_special_news', 'numWords' => 0, 'max' => 10, 'order' => 'reverseurl', 'lang'='ru']); ?>
</div>

I presumed that by adding the lang=ru within this are would work however it doesn't.

Regards
Reply
(2013-09-16, 22:27:49)srsdesign Wrote:
(2013-09-16, 21:50:22)mvlcek Wrote:
(2013-09-16, 21:28:53)srsdesign Wrote: I have created a website using Special Pages to create news items. The site itself is in English and Russian, the english side seems to work fine, however, on the russian side news articles show in both english and russian on the home page. So the question is how can I resolve this?

Use (% searchresults ... lang=ru %)

Many thanks for the prompt reply, please excuse my ignorance!

I am using the View tab in the special pages so under the ru tab my code looks like this:

<div id="left_col">
<?php get_page_content(); ?>
</div>
<div id="mid_col">
<?php get_special_field('projectimg'); ?>
</div>
<div id="right_col">
<h3>latest news...</h3>
<?php get_i18n_search_results(['tags' => '_special_news', 'numWords' => 0, 'max' => 10, 'order' => 'reverseurl', 'lang'='ru']); ?>
</div>

I presumed that by adding the lang=ru within this are would work however it doesn't.

Regards

Sorry ignore this my mistake should of been 'lang' => 'ru' !

Works now....thank you!
Reply
(2013-08-22, 16:24:59)sarnaiz Wrote:
(2013-08-22, 14:08:31)sarnaiz Wrote: Controlling Sort Order

I'm wondering if I might be able to control the sort order or display of special pages and how if I am not wanting to use alpha or chronological order?

I have a special page set up that is a board of director member page with a photo and contact details. I need to list the pages in order of importance-President first, VP next, Secretary next, etc. when pulling them into the display page.

Could I add some kind of field or tag to a page to assign importance and control the sort order that way?

Thank you for any help you can provide.

After reading through some of the posts here I'm thinking menu order is what I was looking for to control the sort order.

After digging around more in the forum I have the following in my template:

<?php get_i18n_search_results(array('tags'=>'staff','max'=>10,'numWords'=>10,'order'=>'-menuOrder')); ?>

I have tried both the + and the - and it does not change the display order.

Ideally I would prefer to have the proper syntax for including it in the page rather than the template. I am creating too many templates for this site.

(% searchresults tags:bod numWords:25 order:-menuOrder%)
This code did not work either.

http://dev.pweaveanea.org/index.php?id=p...nformation

Thank you for any help you can provide,
Sherri
Reply




Users browsing this thread: 12 Guest(s)