custom fields?
Posted: 22 September 2004 05:49 AM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  31
Joined  05-16-2004

Ok, I’ve read the manual and I’ve searched the forums and I still can’t figure this out. :(  It seems to be an easy thing to do, yet, I couldn’t seem to understand anything enough to get it to work. Please pardon if this is somewhere in the forums.


A brief background: My blog/journal is a single blog interface—no other members posting, just me smile  I am using Version 1.0 Build 20040615
(if for no other reason I have been too lazy to upgrade and I wasn’t sure I needed the new functionalities)

In a nutshell what I need to know is how to create a customized field without losing my defaults and what I need to put in my template(s) to make it work.

In detail :
What I would like to do is this

1)a custom entry field with a drop down list of colors, e.g., the display would be Color of the Day:Red; however, I do not want it display if I have not selected a color for the day (which seems to be possible in a custom field)

2)I would like to have this display at the bottom of the entries inline after “posted” by but before categories, comments, etc I want it to have the same style as these, if it is textual.

3)...and if I can really customize it smile  I would like the color of the day to display in its selected color (e.g., Red would display as red colored text) or possibly as a colored circle (gif)

I did try to create a custom field but then it seemed to override my default fields and I couldn’t never seem to get it to display propery (without even trying #3)

The only “groups” I have currently is the default group (which has summary, body, extended text)

So, how do I do 1 & 2 and is 3 even possible? :D

Profile
 
 
Posted: 22 September 2004 08:36 AM   [ Ignore ]   [ # 1 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  9868
Joined  06-19-2002

This is all possible.  First:

1. Go to Admin > Custom Weblog Fields
2. Select “Add/Edit Custom Fields” for the “default” Field Group
3. Click “Create a New Custom Field” in the top right
4. Fill out the info for the new field.  Give it a name (say, “color”), select that it’s a “drop-down list” type, give the options for the list, etc.

Now, go to the Publish section and you should see the new field listed below the “extended” field.


Now you need to display the field.  You’ll have to edit your Templates and insert the new {color} field where you want it to appear inside your {exp:weblog:entries} tag.  For instance, part of your current Template might look like this:

<div class="posted">Posted by <a href="{profile_path=member/index}">{author}</a>
  
on {entry_date format='%m/%d'} at {entry_date format='%h:%i %A'}

You could change it to this:

<div class="posted">Posted by <a href="{profile_path=member/index}">{author}</a>
  
on {entry_date format='%m/%d'} at {entry_date format='%h:%i %A'}

<span style="color: {color}">{color}</span>

or maybe:

<div class="posted">Posted by <a href="{profile_path=member/index}">{author}</a>
  
on {entry_date format='%m/%d'} at {entry_date format='%h:%i %A'}

<img src="/images/colors/{color}.gif" alt="{color}" width="20" height="20" />


If you made one of the color options “none” then you could also conditionally display the color part:

{if color != "none"}

<span style="color: {color}">{color}</span>

{/if}

 Signature 

Chris Curtis
chriscurtis.org

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64939 Total Logged-in Users: 60
Total Topics: 81911 Total Anonymous Users: 52
Total Replies: 440325 Total Guests: 280
Total Posts: 522236    
Members ( View Memberlist )