We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Custom Fields in {exp:weblog:entries /}

Development and Programming

bjsteiger's avatar
bjsteiger
87 posts
18 years ago
bjsteiger's avatar bjsteiger
Mark - What a great extension - especially for those of us with little query knowledge. Thank you!! I just ran into a situation where I need to include two different conditions like this:
{exp:weblog:entries weblog="events" show_future_entries="yes" limit="3" sort="asc" efront="=Yes" esloc="Delaware|Virginia"}
<h2>title</h2>
{body}
{/exp:weblog:entries}
But as I quickly found out - it does not work. Can I have two conditions (notice the last two conditions: efront and esloc), but then look closer at esloc - I tried to include two different settings. Is this possible? If not I would love to add this as a feature request.

bump

       
Mark Huot's avatar
Mark Huot
587 posts
18 years ago
Mark Huot's avatar Mark Huot

ok try the latest version, it should work with multiple conditions, however it will combine them with an AND so you will get entries with efront=”yes” AND esloc=”delaware|virginia”. of course if you wanted to do delaware OR virginia you could use a “sql” attribute like so, to basically create a custom query

{exp:weblog:entries weblog="events" show_future_entries="yes" limit="3" sort="asc" efront="=Yes" sql1="(" esloc="Delaware OR Virginia" sql2=")"}
       
Ronny's avatar
Ronny
83 posts
18 years ago
Ronny's avatar Ronny

First of all: thank you so much for creating this Extension. It seems to work great. But is it possible that it’s not working with url segments?

I’m trying something like this:

{exp:weblog:entries weblog="events" orderby="title" sort="asc" disable="categories|pagination|trackbacks" genre="{segment_4}"}

And of course Genre is my custom field where authors can select from Metal to Classic. If this is not working with your extension I have two questions: - What can be done to make it work? - If there’s nothing that can be done about it, am I correct that the only way to program this is to have a huge list of conditional variable where I have to code each “genre” as a seperate possible query? - Or is there a clever MySQL query that could help me out?

ONce again, thank you very much!!

       
Brian M.'s avatar
Brian M.
529 posts
18 years ago
Brian M.'s avatar Brian M.

I can’t seem to get this to work. I’ve made the changes to mod.weblog.php as listed but it still doesn’t seem to work. Here’s my code:

{exp:weblog:entries weblog="member_job_listings" disable="categories|member_data|trackbacks" orderby="job_application_deadline" sort="asc" paginate="bottom" job_application_deadline="=3"}

job_application_deadline is the custom field. Right now I’m checking to see if it is ‘3’ - it’s a timestamp field so that shouldn’t return any results, but they all show. I’ve messed around with parameter order, as well as removing all the other parameters and still no go.

Any ideas?

EDIT: I’m an idiot. I hadn’t enabled the extension - it’s working great.

Thanks again Mark for your tireless efforts to extend EE!

       
Brian M.'s avatar
Brian M.
529 posts
18 years ago
Brian M.'s avatar Brian M.

This extension doesn’t seem to work if you’re selecting a random entry. What I would like to happen is select a random entry from those with a certain field filled - so it only chooses from the entries with information in that field.

Here’s my code:

{exp:weblog:entries weblog="member_spotlight" limit="1" orderby="random" disable="categories|pagination|member_data|trackbacks|custom_fields" member_spotlight_masthead="/.+/"}

Any way to fix this?

       
Linda A's avatar
Linda A
647 posts
18 years ago
Linda A's avatar Linda A

Is it possible to match a partial pattern? For example, could you get it to display entries where the specific custom field is 2.1, 2.1.1, 2.1.2 and 2.1.2.1 by matching on 2.1*? Or could the greater than option handle that sort of progression too?

       
Mark Huot's avatar
Mark Huot
587 posts
18 years ago
Mark Huot's avatar Mark Huot

Linda, it should work, however, you would want to use the SQL syntax like so: field_name=’2.1%’. I believe that would do it.

       
Mark Huot's avatar
Mark Huot
587 posts
18 years ago
Mark Huot's avatar Mark Huot

The Pie Man, it won’t work when selecting a random entry because EE picks the random entry before my code executes. I’m not too sure what can be done about this. In your specific case it may be easier to just use a full-blown {exp:query sql=""} tag.

       
Linda A's avatar
Linda A
647 posts
18 years ago
Linda A's avatar Linda A
Linda, it should work, however, you would want to use the SQL syntax like so: field_name=’2.1%’.  I believe that would do it.

Should it still work if it needs to fetch the number from a segment? I tried ‘{exp:weblog:entries weblog="{current_weblog}” 32_number_display=”{segment_3}%”}’ and that doesn’t seem to work.

Edited to add: Tested by adding the number straight in there too, but that doesn’t seem to work either. I did do the modifications to get the hooks in, but its possible I did something wrong there.

       
Linda A's avatar
Linda A
647 posts
18 years ago
Linda A's avatar Linda A

I took another look at the modifications needed for the hook, and the bit I am unsure about is the first one. It says to find the section ‘Do we need pagination?’ and to insert the code snipper right before that line. I am not sure if that means right before ‘Do we need pagination?’ or right before ‘if ($this->paginate == TRUE)’?

       
Mark Huot's avatar
Mark Huot
587 posts
18 years ago
Mark Huot's avatar Mark Huot

Since that’s a comment, it shouldn’t matter either way as long as it comes before the PHP ‘if’

       
Linda A's avatar
Linda A
647 posts
18 years ago
Linda A's avatar Linda A

Hmm, okay, then I am pretty sure I have the modification done correctly, so that shouldn’t be the issue.

       
bjsteiger's avatar
bjsteiger
87 posts
18 years ago
bjsteiger's avatar bjsteiger

Mark,

What do you think it would take to add the following feature so it works on an RSS feed tag:

{exp:rss:feed weblog="{my_weblog}" show_expired="yes" sermon_type="Traditional OR Evening"}

....

{/exp:rss:feed}

Thank you in advance!!

       
Mark Huot's avatar
Mark Huot
587 posts
18 years ago
Mark Huot's avatar Mark Huot

@bjsteiger: I’ve never used the {exp:rss:feed /} tag, I always just use the {exp:weblog:entries /} tag in a RSS template. Would that not work? Since it seems that the rss tag just outputs the top content anyways, I’m not sure there would be anything to limit on anyways.

       
bjsteiger's avatar
bjsteiger
87 posts
18 years ago
bjsteiger's avatar bjsteiger

@mark - Hey! You know what I was playing with this morning and you are correct - it does work. I was trying to put the custom tag on the feed portion vs the weblog:entries portion. Thank you for the idea!

       
First 2 3 4 5 6 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.