Easy way to use CustomField

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Easy way to use CustomField

Post by LazyBadger »

For one of my projects I want to use CustomField, which will contain image.
Yes, I know: I can write img src="uploads/*stars.gif", but - it's long and not bulletproof writing.
I'll prefer to write smth. like{$one}...{$ten} as CF-value
Can I do it andif yes - how?
Quis custodiet ipsos custodes?
yellowled
Regular
Posts: 7111
Joined: Fri Jan 13, 2006 11:46 am
Location: Eutin, Germany
Contact:

Re: Easy way to use CustomField

Post by yellowled »

LazyBadger wrote:For one of my projects I want to use CustomField, which will contain image.
I think the custom fields option of the extended entry properties plugin is just what you're looking for.

YL
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: Easy way to use CustomField

Post by LazyBadger »

Well, custom fields from ExtendedProperies is tool of choice (and was before I started topic - I just don't know another solution).
I just asked - how to write in field less text, if I have (5-10) hardcoded patterns and too lazy repeat all html every time
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Easy way to use CustomField

Post by garvinhicking »

Hi!
LazyBadger wrote:Well, custom fields from ExtendedProperies is tool of choice (and was before I started topic - I just don't know another solution).
I just asked - how to write in field less text, if I have (5-10) hardcoded patterns and too lazy repeat all html every time
You only need to do that once in the plugin setup, not every time?!

You could also code a simple PHP script that creates your patterns so that you can copy&paste them:

Code: Select all

<?php
$patterns = explode('content,description,header');
$iterations = 10;
$i = 0;
while($i <= $iterations; $i++) {
  $i++;
  foreach($patterns AS $pattern) {
    echo $pattern . $i . ",";
  }
}
HTH
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/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: Easy way to use CustomField

Post by LazyBadger »

garvinhicking wrote:
You only need to do that once in the plugin setup, not every time?!
In plugin setup I can change fields count, field name and nothing (?) more. My task is
in single field in every entry write like this (changeable parts are italicized)

Rating<br />
<img src="uploads/one.gif">&nbsp;&mdash;&nbsp;<span class="one">Terrible</span>

Using event_smarty for CF can be excellent solution
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Easy way to use CustomField

Post by garvinhicking »

Hi!

Sure, you can simply enter "one" in your custom field, and then change your entries.tpl to use that placeholder to emit the complete HTML.

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/
Post Reply