if no_related_entries
Posted: 25 January 2008 02:15 PM   [ Ignore ]  
Lab Assistant
Avatar
RankRank
Total Posts:  130
Joined  12-21-2005

I am using related entries pretty much the exact way it is described in the User Guide. However in the case where a venue is not yet entered I am giving users the option to use a Location Other field.

I have tried this but it doesn’t appear to work.

{related_entries id="calendar_location"}
  {if no_related_entries}
     {calendar_location_other}
  {
/if}
{title}
{
/related_entries}

Rather than display the {calendar_location_other} it displays “{calendar_location_other}”.

 Signature 

Phil J Leitch - Unwound Design

Profile
 
 
Posted: 26 January 2008 02:09 AM   [ Ignore ]   [ # 1 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  671
Joined  06-29-2005

Is {calendar_location_other} a field contained in the related weblog or is it in the current weblog that possesses the related entry?

Just talking through my hat here, but if the latter, you may need another exp:weblog:entries tag to display this one field.

{related_entries id="calendar_location"}
  {if no_related_entries}
     {exp
:weblog:entries weblog="my_weblog" limit="1" dynamic="off"}{calendar_location_other}{/exp:weblog:entries}
  {
/if}
{title}
{
/related_entries}

But that could be waaayyyy wrong - I’ve not tested it or chased through the docs, nor have I seen the rest of your code for context.

Terry

 Signature 

Terry Leigh Britton
http://twitter.com/TerryBritton
http://twitter.com/Terr_ee

Search the web using Terry Leigh Britton to find all kinds of stuff I’m into!
Or use Yasni for Terry Leigh Britton

Profile
 
 
Posted: 26 January 2008 09:08 AM   [ Ignore ]   [ # 2 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  130
Joined  12-21-2005

Sorry for not making that more clear.

{calendar_location_other} is a field in the weblog that also contains the related field.

First a user is given the related field location with a drop down.

If the location they are looking for isn’t in the drop down they can then use the next field, Location Other, to skip the process of adding a new location to the drop down (which I discourage but writers are lazy).

 Signature 

Phil J Leitch - Unwound Design

Profile
 
 
Posted: 26 January 2008 02:51 PM   [ Ignore ]   [ # 3 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  671
Joined  06-29-2005

If that is the case, does the code snippet I posted do the trick? I would think that would work in that case.

If not, I wonder why not?

You might want to add a test inside that line for whether they actually filled out that field as well.

{related_entries id="calendar_location"}
  {if no_related_entries}
     {exp
:weblog:entries weblog="my_weblog" limit="1" dynamic="off"}{if calendar_location_other}{calendar_location_other}{/if}{/exp:weblog:entries}
  {
/if}
{title}
{
/related_entries}

But it could be the case that an {exp:weblog:entries} tag cannot exist within a {related_entries} tag pair. Try it out, I guess.

Terry

 Signature 

Terry Leigh Britton
http://twitter.com/TerryBritton
http://twitter.com/Terr_ee

Search the web using Terry Leigh Britton to find all kinds of stuff I’m into!
Or use Yasni for Terry Leigh Britton

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 1743, on December 02, 2009 03:47 PM
Total Registered Members: 120130 Total Logged-in Users: 77
Total Topics: 126275 Total Anonymous Users: 41
Total Replies: 664122 Total Guests: 327
Total Posts: 790397    
Members ( View Memberlist )