publishing date as a period

Creating and modifying plugins.
hkit
Regular
Posts: 25
Joined: Mon Oct 10, 2005 11:20 am

publishing date as a period

Post by hkit »

Hi there,

I would like to ask if there is a possibility to set the publishing-date of an article as a period (for example 30.01.2006 - 2.2.2006) - I thought maybe there is a plugin for that. If there is non, perhaps this could be considered as a new feature/plugin?

Does anybody has an idea.

thanks, best regards
Stefan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: publishing date as a period

Post by garvinhicking »

Why would you need that?

You might want to use the Custom Fields feature of the Entryproperties plugin. There you can create a field like "timeperiod" and enter your time range. Then you can edit your entries.tpl file and output the timeperiod wherever you want.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
hkit
Regular
Posts: 25
Joined: Mon Oct 10, 2005 11:20 am

Re: publishing date as a period

Post by hkit »

Thank you very much for your help, Garvin.
garvinhicking wrote:Why would you need that?
Because we are using the serendipity-tool as an event-calendar, where articles are actually used as event-description. And as some events happen to take place on several days in a row, we don't want to include the same text on each of these days.

I looked up SourceForge.net, but I couldn't find the plugin you were refering to, Garvin. Are your sure it is called like that?

thanks & best regards
Stefan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: publishing date as a period

Post by garvinhicking »

Okay, then in your case the Custom Field method and modifying the entries.tpl template should do easily.

The plugin is called "Extended Properties for entries" and is bundled with Serendipity already - you'll need to use Serendipity 0.9.1 at least. The custom Fields are explained in depth on a blog.s9y.org article, you might want to look that up. :)

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
hkit
Regular
Posts: 25
Joined: Mon Oct 10, 2005 11:20 am

Post by hkit »

Hi Garvin,

I appreciate your help. I have problems with those smarty-tags. It seems to me, the server doesn't interpret them - as there is a white page if I include them in the template file. Is this possible? Because I thought Smarty would have been installed and configured while installing Serendipity, as you use these smarty-tags in your code also. Or am I wrong?

thanks
Stefan
Guest

Post by Guest »

Stefan, what is the code you're entering?

It should and does work. :-)

Regards,
Garvin
hkit
Regular
Posts: 25
Joined: Mon Oct 10, 2005 11:20 am

Post by hkit »

I entered that line in the HTML-code:

Code: Select all

{$entry.properties.ep_evenmang_borja}
"evenmang_borja" is the variable's name. Well, I tried a lot of other things too, but the result has been the same each time.

tackar & hälsningar
Stefan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Where exactly in the HTML code did you place it.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
hkit
Regular
Posts: 25
Joined: Mon Oct 10, 2005 11:20 am

Post by hkit »

in the entries.tpl.php-file like there:

Code: Select all

                <?php endif; ?>
            <?php endforeach; endif; unset($_from); ?>
            </span>
            <?php endif; ?>

            <div class="serendipity_entry_body">
                <?php echo $this->_tpl_vars['entry']['body']; ?>
	<br />
	{$entry.properties.ep_evenmang_borja}
            </div>

            <?php if ($this->_tpl_vars['entry']['is_extended']): ?>
            <div class="serendipity_entry_extended"><a id="extended"></a><?php echo $this->_tpl_vars['entry']['extended']; ?>
</div>
            <?php endif; ?>

I tried to place it in other places also, but there was no change.

best regards
Stefan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

That was the absolute wrong file to edit. *eg* The templates_c/ folder is unappropriate to edit any files in.

I was talking of entries.tpl, which resides in your templates/XXX folder. If your folder doesn't have it, copy over templates/default/entries.tpl. :-)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
hkit
Regular
Posts: 25
Joined: Mon Oct 10, 2005 11:20 am

Post by hkit »

garvinhicking wrote:That was the absolute wrong file to edit. *eg* The templates_c/ folder is unappropriate to edit any files in.
Hej Garvin,

Actually, I had this thought some long time ago also ;), but didn't really bother about it, since it worked for me anyway... until yesterday. So thank you for that.

There is one more little question I would like to ask. Is it possible to change the value of these customfields? I would like this value to be a timestamp and furthermore I would like to use this variable in the serendipity_fetchEntries-function. I had a quick and dirty look at the entryproperties.php-file and I assume you don't add the customfields to the db-entry. Is that right?. Would you be so kind to give me a hint how I would do that the best way?

Thank you & best regards
Stefan
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

hkit: You can store anything inside your custom fields! That's why they are custom :-)

You can also use Smarty conversion functions to convert a human readable time like "24.12.2005" into a unix timestamp, which is then put through to a fetchentries call [this smarty call only works in serendipity 1.0-alpha, but I guess you know that].

The customfields are stored in the "serendipity_entryproperties" database table!

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
hkit
Regular
Posts: 25
Joined: Mon Oct 10, 2005 11:20 am

Post by hkit »

garvinhicking wrote:You can also use Smarty conversion functions to convert a human readable time like "24.12.2005" into a unix timestamp, which is then put through to a fetchentries call [this smarty call only works in serendipity 1.0-alpha, but I guess you know that].
Hi Garvin,

thanks for your reply. I didn't know there is a 1.0-alpha-version... But let's see if I did get right what you mentioned above (considering my little programming skills):
in the new serendipity-version do I have the possibility to use these custom-fields (of course). If I include this variable in the .tpl-file it'll be possible to use it in the fetchentries-function? which means it is stored in the entries-table? Is that right?

By now I haven't seen a link on the homepage to download this 1.0-alpha-version. Is it already possible to download that version?

thanks & regards
Stefan
Col. Kurtz
Regular
Posts: 450
Joined: Thu May 26, 2005 10:43 am
Location: Bonn, Germany
Contact:

Post by Col. Kurtz »

go to the download page [http://www.s9y.org/12.html] , under the normal version [labeled fetch a snapshot] you can download the nightlies with the up to date version, that is 1.0 alpha.
Marc
hkit
Regular
Posts: 25
Joined: Mon Oct 10, 2005 11:20 am

Post by hkit »

thanks Marc
Post Reply