Extended Properties for Entries: Custom Fields

As a response to a Feature Request from Karotte, I have just committed an enhancement to the entryproperties plugin to 0.9-beta3 of our SVN (which will hopefully be turned into a 0.9 final at the end of this month).

The plugin configuration has now been altered so that you can add a comma-separated list of custom fieldnames, which you can then fill in when creating an entry.

That means, you can create two custom fields called Listening and Playing (don't use whitespace or special characters for fieldnames). Create an entry, and fill in values for those two fields. Now edit your entries.tpl template and place the Smarty Codes

Now listening to: {$entry.properties.ep_Listening}
Now playing: {$entry.properties.ep_Playing}

anywhere you like inside the entry loop. Remember to prefix your property keyname with ep_. Then you'll see those fields at the place you configured. You can also add the usual Smarty markup to check if a variable is empty, and add some DIV or other tags to surround your output.

This brings Serendipity a bit closer to CMS-features, once again. :-)

(The SVN nightlies will be built tomorrow, containing the new patch. SVN checkouts contain the change already at this time - users familiar with SVN only need to fetch the plugins/ serendipity_event_entryproperties/ serendipity_event_entryproperties.php file)

Trackbacks

Trackback-URL für diesen Eintrag

  • Keine Trackbacks

Kommentare

Ansicht der Kommentare: (Linear | Verschachtelt)

Rembrandt am um :

Ja das ist ja wirklich mal ein geiles Feature! Erspart mir zwar nicht sonderlich viel aber immerhin doch etwas an Schreibarbeit. Allerdings sollte man vielleicht darauf hinweisen, dass die entries.tpl die vielleicht bessere Datei zum einbinden des Smarty Codes ist, oder? Vollkommen großartig wäre es überdies hinaus, wenn man dieses "CustomField" jetzt noch mit der Ausgabe eines externen Scripts (oder evtl. eines Plugins) verknüpfen könnte - dann bräuchte ich bei "Playing: ..."-Statements gar nicht mehr tippen. ;)

so long... Rembrandt

Rembrandt am um :

Örgs - wer lesen kann ist klar im Vorteil. Einfach das gesagte mit der entries.tpl vergessen...

Garvin am um :

I'm replying here in english, hope you don't mind.

Rembrandt asked, that it would be great if you could associate external plugins with the new CustomFields.

This is already possible! Your plugin can just hook into one of the events where entries are fetched ('entrydisplay' or 'frontenddisplay' or even 'frontend_entryproperties') and then just set your $eventData property index to what you want to be displayed later on.

However, this was already possible even before CustomFields got invented. You can add your very own plugin hooks easily into the entries.tpl template, like this:

{serendipityhookPlugin hook="customnow_playing" hookAll=true"}

Then just let your plugin to all the work. http://www.s9y.org/78.html describes this as well.

Regards, Garvin

Rembrandt am um :

Thx for your reply (reading English is much easier for me than writing it (correctly) ;)!

So I'll have a closer look to hooks and the "magical stuff" behind them.

so long... Rembrandt

MySchizoBuddy am um :

ok let me know if this is corect.

1) in the Extended properties for entries plugin page. i change customfield1 to "Now listening to;" 2) when i make a post i type in "NIrvana" 3) inside my entries.tpl file I place this "Now listening to: {$entry.properties.ep_Listening}"

and then {$entry.properties.ep_Listening} is replaced by NIrvana

Is this how it is supposed to work. the place where i enter the word NIrvana, does it take html or simple text.

Garvin am um :

No, this is wrong. The description of the field says "don't use spaces in the field name". So "NowListeningto" would work instead.

The input field takes any HTML code.

Kommentar schreiben

Die angegebene E-Mail-Adresse wird nicht dargestellt, sondern nur für eventuelle Benachrichtigungen verwendet.

Um maschinelle und automatische Übertragung von Spamkommentaren zu verhindern, bitte die Zeichenfolge im dargestellten Bild in der Eingabemaske eintragen. Nur wenn die Zeichenfolge richtig eingegeben wurde, kann der Kommentar angenommen werden. Bitte beachten Sie, dass Ihr Browser Cookies unterstützen muss, um dieses Verfahren anzuwenden.
CAPTCHA

BBCode-Formatierung erlaubt
Markdown-Formatierung erlaubt