ExpressionEngine 2024 Quarter 1 Review Quarter 1 Review
Okay my my problem is the url of a title inside a relationship field… To be specific… I am using my edited version of the pre-installed site theme…
Let me start with the pre-installed template groups… Home About Blog Contact Layout
Okay now I have cloned the Blog Template group and named it Test Template Group. Inside that cloned group is a template called Entry.
Inside that Entry is an edited version of it. Basically every word with a Blog was replaced with Test. The {blog_content} has been change to {page_content} and is now a Fluid Field. I put all the pre-installed Audio, Video, Image fields inside the Fluid Field and then added more fields inside Fluid Field. Everything was smooth until I added a Relationship Field inside the Fluid Field. The Problem occurs when I related the Entry named Contact. Inside Contact Entry has 4 fields, one of the field is a Title URL field which is a contact-us entry inside the Relationship Field.
I didn’t want to paste all the fields here inside the Fluid Field and only pasted the problem which is the relationship field.
See below to understand…
<– Start of Edited Header of Template –>
{layout='layouts/_test-layout'}
{!– Redirect ============ This is a test single entry page, it’ll never need a fourth segment, so we use the following code to make sure the page redirects if someone types in an incorrect URL in the browser address bar, by adding new segments. i.e. http://example.com/test/entry/title/nothing –} {if segment_4} {redirect='{segment_1}/{segment_2}/{segment_3}’} {/if}
{!– page vars (prefix p_) –} {preload_replace:p_title='My Test'} {preload_replace:p_description='A Test about things, things I like and things I do.'} {preload_replace:p_url='test'} {preload_replace:p_url_entry='entry'} {!– channel vars (prefix ch_) –} {preload_replace:ch='test'} {preload_replace:ch_disable='category_fields|member_data|pagination'} {!– layout vars, channel/page related –} {layout:set name='ch' value='{ch}’} {layout:set name='p_url' value='{p_url}’} {layout:set name='p_title' value='{p_title}’}
{!– single-entry pagination –} <div class=”paginate single”> {exp:channel:prev_entry channel='{ch}’} Previous {/exp:channel:prev_entry} {exp:channel:next_entry channel='{ch}’} Next {/exp:channel:next_entry} </div> {!– required_entry makes it so if someone types the wrong URL, they will get a 404 page –} {exp:channel:entries channel='{ch}’ disable=’{ch_disable}’ limit=’1’ require_entry=’yes’} {!– layout vars, dynamic, not output –} {layout:set name='title' value='{seo_title}{gv_sep}{p_title}{gv_sep}’} {layout:set name='description' value='{seo_desc}’} {layout:set name='entry_ch' value='{ch}’} {!– OpenGraph meta output –} {layout:set name='og_title' value='{seo_title}’} {layout:set name='og_url'}{path='{p_url}’}{/layout:set} {layout:set name='og_description' value='{seo_desc}’} {!– /layout vars, dynamic, not output –} <h1>{title}</h1>
<– End of Edited Header of Template –>
<– Start of Edited Body of Template –>
{page_content}
Audio, Video, Image and more fields here… Then this problem below occured…
{!– Insert Entry - a field that outputs' related entries –}
{page_content:insert_entry} {content status="open"} {if content:count == 1}
{/if}
<– Start of Problem–>
<– The {content:url_title} outputs this link “https://www.sitename.me/index.php/Test/entry/contact-us” instead of this “https://www.sitename.me/index.php/Contact/entry/contact-us” So instead of Contact it is the Test channel which I cannot see where the solution is? Also, Contact is the Channel and contact-us is the entry…–>
Related entry title: {content:title}
<– End of Problem –>
{content:contact_address}
{contact_address:street} {contact_address:street_2} {contact_address:city} {contact_address:state} {contact_address:zip} {/content:contact_address}
{content:contact_phone}
{content:contact_email}
Related entry file field, med custom image size: {content:my_file:med wrap="image"}
{/content} {/page_content:insert_entry}
{/page_content}
{!– /content output –}
….
Thank you for checking this far! Any help is appreciated!
this my specific problem:
Related entry title: [code]<a href="http://{content:url_title}">[/code]{content:title}</a>
The {content:url_title} outputs this link “https://www.sitename.me/index.php/Test/entry/contact-us” instead of this “https://www.sitename.me/index.php/Contact/entry/contact-us”
any suggestions? maybe an if statement or something?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.