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

jeremydouglas's avatar
jeremydouglas
292 posts
17 years ago
jeremydouglas's avatar jeremydouglas

haha, sorry I meant to say relationship fields (wow, I needed sleep more than I thought). Like Roger posted a couple pages back.

Posted: 29 June 2007 09:40 PM I am just trying this extension for my old EE 1.5 site. After checking out this thread a bit, it works fine now. IT’s GREAT. But I discovered that when I change a field in the weblog to a “RELATIONSHIP” field, it returns no records. I am sure that I only change a field to “RELATIONSHIP” before that it’s working and returning what I want. Can anyone help ? Or how can I deal with a relationship field where I want to display a value according to the current weblog field ? Roger.
       
Mark Huot's avatar
Mark Huot
587 posts
17 years ago
Mark Huot's avatar Mark Huot

hum, yes it’s true this won’t work with relationship fields because of the way the data is stored. But couldn’t you just use a reverse related entry for that? Or if you need a lot more control you can always use a direct {exp:query /}

       
jeremydouglas's avatar
jeremydouglas
292 posts
17 years ago
jeremydouglas's avatar jeremydouglas

ah yes, I’m still an ee rookie, I couldn’t use the {exp:query } ‘cuz the site I was working on for this was just a core version. Was trying to think of another way.

Thanks Mark

       
Hop Studios's avatar
Hop Studios
459 posts
17 years ago
Hop Studios's avatar Hop Studios

Mark,

I tried it using just plain article_type=”Hop” as well – same lack of effect. And yes, case matters and I’m sure it’s exactly like “Hop”.

TTFN Travis

       
Ryan M.'s avatar
Ryan M.
1,511 posts
17 years ago
Ryan M.'s avatar Ryan M.

Sheesh, I’ve been messing with this one all day and just cannot seem to get it to work. So I’m in “that” camp. Good thing I’ve worked my way around SQL queries in the past as I’ll probably have to resort to the query module, methinks.

Can we just get an updated EE build where this is native functionality and be done with the 10 page thread and core mods? I mean I know it’s just that easy! Thanks! 😝

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

mdesign, please submit a feature request for this, or bump and existing one. i’d love to see this functionality built into EE. As for your broken issue: what exactly isn’t working? What kind of field are you limiting on?

       
Ryan M.'s avatar
Ryan M.
1,511 posts
17 years ago
Ryan M.'s avatar Ryan M.

I searched around for an existing Feature Request and couldn’t seem to find one, so I put in a new Feature Request for Custom Fields In weblog:entries Tag. I got what I needed on this particular site with some query module usage. Thanks, Mark.

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

I am having some problems getting the extension to work in a specific scenario (it works fine in another blog, so it is correctly installed at least). Its possible, though, that what I am trying to do isn’t possible, or that I am overlooking something that doesn’t have to do with the extension.

This is what I’ve got:

1)

{exp:weblog:entries weblog="{current_weblog}" 9_id_display=">{segment_3}" limit="1" orderby="9_id_sorting" sort="asc" disable="pagination" dynamic="off"}

What it does is determine which weblog entry to show based on a number provided as segment 3 and which each weblog entry has stored in a custom field. It works fine for 1-8. If the segment is 9, the page comes up with no weblog entry at all. If its 10 or over, it shows the entry with a 2 in the custom field. Why this doesn’t work, I am not quite sure, but I am guessing its down to how things get sorted?

2)

{if segment_3 == "1"}

{exp:weblog:entries weblog="{current_weblog}" limit="1" orderby="9_id_sorting" sort="desc" disable="pagination" dynamic="off"}

{if:else}

{exp:weblog:entries weblog="{current_weblog}" 9_id_display="<{segment_3}" limit="1" orderby="9_id_sorting" sort="desc" disable="pagination" dynamic="off"}

{/if}

A similar setup here, but here its going to the weblog entry where the custom field is one number lower than the number in the segment. The problem here is that no matter what the number in the URL is, I keep getting the link for the site with the highest number.

Again, I am not sure if the custom field extension or something else is the problem, but perhaps you could help me rule it out, at least? 😊

       
django6's avatar
django6
124 posts
17 years ago
django6's avatar django6

I can get this to work with a simple query like the one’s you’ve listed in your very first post

Example: {exp:weblog:entries custom_field="pattern"}{title}{/exp:weblog:entries} {!– any entry with 'pattern' in the custom field –}

but what if I have several custom fields that are muti-drop-down lists and I want to query with logical AND OR operators. Can your extension work with these operators and what is the correct syntax?

Here’s something I want to do, but I’m not sure how to write it:

{exp:weblog:entries weblog="dailyblog" industries="Telecommunications OR Health Care" AND chapter="Chapter 4" max="3"} <div class=”blog”>

{title}

    <div class="date2">Posted on {date_of_article format="%M %d, %Y - %h:%i %A"}</div>
    {main_text}
</div> <!-- end blog --> 

{/exp:weblog:entries}

both of these fields are multi-drop-down. How can I create this kind of logic with this extension? ((industries=”Telecommunications OR Health Care”) AND chapter=”Chapter 4”)

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

give this a try

{exp:weblog:entries sql1="(" industries1="Telecommunications" sql2=" OR " industries2="Health Care" sql3=") AND " chapter="Chapter 4"}
...
{/exp:weblog:entries}
       
django6's avatar
django6
124 posts
17 years ago
django6's avatar django6

okay, I’ll give it a try, but what does it mean?

I don’t understand what the sql1=”” notation is about–is it some kind of sql inlining? Also, I only have one multi drop down variable called industries, how does the industries1, industries2 work?

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

sql1, sql2, sql3… allows you to inject sql between the attributes industries1, industries2… allows you to use the same attribute more than once (using industries twice would only allow EE to see the last instance of it)

       
django6's avatar
django6
124 posts
17 years ago
django6's avatar django6

Okay I get it now, thanks. That is some strange looking syntax to me. Is this part of EE or part of your extension and do you know where I can read about these rules on my own?

       
django6's avatar
django6
124 posts
17 years ago
django6's avatar django6

I get the the following error with this line:

{exp:weblog:entries weblog="dailyblog" sql1="(" industries1="Telecommunications" sql2=" OR " industries2="Health Care" sql3=") AND " chapter="Chapter 4: The Power of Play" max="3"}

I tried adding a WHERE in sql1, but that doesn’t fix it. It works fine if I don’t use an AND OR operators or sql. Any ideas? Do you think it would be easier to accomplish this using the query module instead of the extension?

MySQL ERROR:

Error Number: 1064

Description: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘OR ) AND d.field_id_11 LIKE ‘ h;apter 4: The Power of Play%’ WHERE t.entry_id !’ at line 2

Query: SELECT t.entry_id FROM exp_weblog_titles AS t LEFT JOIN exp_weblogs ON t.weblog_id = exp_weblogs.weblog_id LEFT JOIN exp_members AS m ON m.member_id = t.author_id INNER JOIN exp_weblog_data AS d ON t.entry_id=d.entry_id AND ( OR ) AND d.field_id_11 LIKE ‘ h;apter 4: The Power of Play%’ WHERE t.entry_id !=” AND t.site_id IN (‘1’) AND t.entry_date < 1189020788 AND (t.expiration_date = 0 || t.expiration_date > 1189020788) AND exp_weblogs.is_user_blog = ‘n’ AND t.weblog_id = ‘2’ AND t.status = ‘open’ ORDER BY t.sticky desc, t.entry_date desc LIMIT 0, 100

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

Ok, (feeling silly) that was my fault. I gave you the code for an idea I’ve been toying around with, but never implemented. It’s now in version 2.1.8. If you end a custom field with ‘__1’ or ‘__2’ etc. the suffix will get chopped off, so download the latest version and switch your entries tag to the following:

{exp:weblog:entries weblog="dailyblog" sql1="(" industries="Telecommunications" sql2=” OR “ industries__1="Health Care” sql3=") AND “ chapter="Chapter 4: The Power of Play” max="3"}
       
First 10 11 12 13 14 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.