When entering content, is there a way to mistake-proof entering links to other url-titles on the site without entering the full URL?
I am setting up an EE website using Structure and Low Variables. Structure is managing the "page" content in a channel called "Pages," and there are several other channels for various dynamic content listings. I am using Low Variables to manage snippets of code, various settings, and bits of content such as company contact information.
As part of the home page, I have several "featured" sections with similar formatting. Each has the option for a title, image, link, and blurb of text. The client would like to be able to select from any content on the site (as well as presumably content NOT on the site). I setup a channel called "Features" with the following fields: title
(Text Input),feature_url
(Text Input -- default text formatting "None"), feature_image
(File), and feature_body
(Textarea).
The client would select which entries from the "Features" channel to display on the Home page using a select list in Low Variables.
I setup the Home page template as follows:
<!-- Feature Section -->
<div class="row">
{exp:channel:entries channel="Features" dynamic="no" limit="3" disable="{lv_shortcuts_disable_default}"}
<div class="column one-third">
<div class="pic">
{feature_image}{if feature_url != ""}<a href="{feature_url}">{/if}<img src="{url:feature3}" alt="" />{if feature_url != ""}</a>{/if}{/feature_image}
</div>
<h3>{if feature_url != ""}<a href="{feature_url}">{/if}{title}{if feature_url != ""}</a>{/if}</h3>
<p>{feature_body}</p>
</div>
{/exp:channel:entries}
</div>
<!-- Feature Section::END -->
When entering content, I have tried typing in the url_title
of another page on the site, but the template wraps the url_title
in <p></p>
tags when rendering. (Example: entering "/index.php/our-work" in the entry field yields http://localhost:8080/mysite/<p>/index.php/our-work</p>
.) Entering a full URL which includes "http://
" works as expected. Also, if the url_title
of the other entry changes this entry will have a broken link.
So I guess I have two problems:
- First, I would like an easy way for my client to select from
existing content "pages" in a way that is straightforward and
mistake-proofed if the
url_title
of a page changes. Ideally, this would be a select list. (If they want to enter a link to an external page, I could have a separate variable for that.) - Second, I need those relative links to display in the template correctly without being wrapped in paragraph tags.
Does anyone have any experience with doing something like this? Any advice to help me?