I wish to display a new page when the confirm status is met using expression engine. Please see code below:
<div class="column">
<p><button type="submit" class="submit" name="submit"><span>Submit Order</span></button> </p>
{if segment_2 == "confirm"}
{/exp:channel:Confirmation}
{/if}
</div>
If you have created a template that displays a confirmation message you can redirect to it inside a conditional:
{if segment_2 == "confirm"}
{redirect="template_group/template"}
{/if}
Though there might be a better way depending on what was used to create the form. Both Channel Form (Safecracker) and Freeform accept a return="" parameter that you can use to redirect people on submission.
Related
This is my situation :
<form action=“destinationpage/”>
<select name=“localita” id=“localita” >
<option></option>
{exp:channel:entries channel="localita"}
<option>{nome_localita}</option>
{/exp:channel:entries}
</select>
</form>
How can i get the select value not using php on my action form page?
I need to have : mywebsite.com/destinationpage/SELECTVALUE
Many thanks for your help!
I am on an expression engine entry page with a few hyperlinks...
Go Form
Go2 Form
Based on which hyperlink I click, I want to navigate to another expression engine page with a contact form and dynamically set the value of the subject field based on which hyperlink was clicked on the previous page......How do I go about doing this? Can I set a parameter value which then gets passed to the expressionengine session so I can reference it in the Contact Form page? Perhaps a mechanism like the below?
<a href="http://example.com/expressionenginepage/" ee_value=1>Go Form</a>
<a href="http://example.com/expressionenginepage/" ee_value=2>Go2 Form</a>
I've done something similar to this with selects, but the principle is the same for text fields.
Simply treat the 2nd URL segment as the variable.
So you have your form page here:
http://example.com/expressionenginepage/
If you want the subject line on that form to be pre-filled out as "Please call me", compose the link as
http://example.com/expressionenginepage/call
If want the subject line on that form to be pre-filled out as "I need help", compose the link as http://example.com/expressionenginepage/help
Then on your template 'expressionenginepage' look at the segment_2 variable and conditionally serve the subject line that you desire.
{if segment_2 == 'call'}
<input id="subject" type="text" value="Please call me">
{if:elseif segment_2 == 'help'}
<input id="subject" type=text value="I need help">
{if:else}
<input id="subject" type=text value="">
{/if}
Have a fairly basic template that outputs the main article and then should output three others from the same channel, however when using the following code nothing is output in the "Other partners" area, not even "No posts" so I'm really not sure what's going wrong. There's 5+ articles in the system so there's definitely results to pull out, any ideas?
{exp:channel:entries channel="partner" limit="1" url_title="{segment_3}"}
<article>
<h1>{title}</h1>
{profile_logo:banner wrap="image"}
{profile_body}
</article>
{/exp:channel:entries}
<h2>Other Partners</h2>
{exp:channel:entries channel="partner" related_categories_mode="yes" custom_fields="yes"}
{if no_results}
No posts
{/if}
<article>
<a href="{url_title_path='community/partners'}">
{profile_logo:thumbnail wrap="image"}
<h3>{title}</h3>
<p>{profile_body}</p>
</a>
</article>
{/if}
{/exp:channel:entries}
Looks like you have a random {/if}, not sure if that's causing the issues with the results. You could always pass the current category to a embed and run it like so:
{exp:channel:entries channel="partner" limit="1" url_title="{segment_3}"}
<article>
<h1>{title}</h1>
{profile_logo:banner wrap="image"}
{profile_body}
</article>
{embed="template_group/_related_partners" category="{categories backspace="1"}{category_id}|{/categories}"}
{/exp:channel:entries}
Embed template:
{exp:channel:entries channel="partner" category="{embed:category}" dynamic="no" url_title="not {segment_3}"}
{if no_results}
No posts
{/if}
<article>
<a href="{url_title_path='community/partners'}">
{profile_logo:thumbnail wrap="image"}
<h3>{title}</h3>
<p>{profile_body}</p>
</a>
</article>
{/exp:channel:entries}
Probably all you need to do here is add dynamic="no" parameter to your second channel entries loop where you are using related_categories_mode. You need to do this because you are on a single entry page and EE will try to use the url_title present in segment_3 to load channel data for that entry specifically.
So you should try:
<h2>Other Partners</h2>
{exp:channel:entries channel="partner" related_categories_mode="yes" custom_fields="yes" dynamic="no"}
[...]
{/exp:channel:entries}
Official documentation for the dynamic= parameter is here.
Also be sure the entry you are loading in the browser is categorized in such a way that there are indeed other entries in that channel that are similarly categorized. Without some other entries that share the same category(ies) no entries will be loaded by the channel loop where you are using related_categories_mode.
Also, as #Seibird mentioned, it does look like you have an extra closing if tag after the closing article tag in your code example. That is likely to be interfering.
I have a snippet called sidebar with the following code.
<div id="ebook_offer">
{exp:channel:entries channel="test"}
<h3>Ebook</h3>
{/exp:channel:entries}
</div>
<div id="about_blog">
{exp:channel:entries channel="blog_sidebar"}
<h3>About Obsia's Blog</h3>
{/exp:channel:entries}
</div>
<div id="testimonials">
</div>
<div id="demo" dynamic="no" limit="1">
</div>
<div id="recent posts">
{exp:channel:entries channel="blog" limit=5 offset=1}
<h3>Recent Posts</h3>
<li>{title}</li>
{/exp:channel:entries}
</div>
<div "connect">
</div>
<div = "subscribe">
{exp:mailinglist:form list="blog_list" form_id="blog_subscribe"}
<h3>Subscribe</h3>
<p>First Name <input type="text" name="first_name"="{first_name}"></p>
<p>Email <input type="text" name="email" value="{email}"></p>
<p><input type="submit" value="submit"></p>
{/exp:mailinglist:form}
</div>
This snippet is called inside the index.php template for blog template group and the code is as follows:
<div id="blog_display">
{exp:channel:entries channel="blog" limit="5"}
<h2>{title}</h2>
{author}
{if blog_images} <img src="{blog_images}" alt="blog image {title}" class="some_class" />
{/if}
{teaser}
<p>comments {comment_total} </p>
{/exp:channel:entries}
</div>
{sidebar}
I also have channel called sidebar with fields such as ebook_offer, about_blog, recast posts, testimonials, subscribe. I can get the subscribe forms to show up. I can see recent posts on my webpage but can't see any of the content that has been filled in about_blog field.
Anyone know why blog channel works but not my sidebar channel.
I'm not quite sure what the problem is exactly without having all of your code in front of me, but it could be a few things. For starters, if your blog homepage template has an {exp:channel:entries} tag in it, and you're including the snippet inside of that tag, you'd run into problems. You can't nest an {exp:channel:entries} inside of another.
Also, channel entry tags are set to dynamic by default. They will look at the URL for hints about what entries to pull from the database. Try adding the dynamic="no" parameter to your sidebar entries tag, which you can learn more about here. This should make the tag ignore the page's URL, which is what you want. You might also want to add the limit="1" parameter to that tag as well, to ensure that only one sidebar entry is being rendered.
Please let me know if neither of those answers help!
The best strategy would be to move what's in your snippet into a separate template file while you try to figure this out. I noticed a couple of things that seem off to me in your sidebar snippet code.
<div id="ebook_offer">
{exp:channel:entries channel="test"}
<h3>Ebook</h3>
{/exp:channel:entries}
</div>
<div id="about_blog">
{exp:channel:entries channel="blog_sidebar"}
<h3>About Obsia's Blog</h3>
{/exp:channel:entries}
</div>
This doesn't really seem the right way to use the {exp:channel:entries} tag. You mentioned "ebook_offer" was a channel field. But here you're using it as a static id for an HTML div. If "ebook_offer" is a field I would expect something like this:
<h3>Ebook</h3>
{exp:channel:entries channel="test"}
{ebook_offer}
{/exp:channel:entries}
Same with "about_blog"
<h3>About Obsia's Blog</h3>
{exp:channel:entries channel="blog_sidebar"}
{about_blog}
{/exp:channel:entries}
Also I noticed you said the channel was named "sidebar" but in your {exp:channel:entries} tag you're using "blog_sidebar". Which isn't the same thing, is your channel's shortcode "sidebar" or "blog_sidebar"?
Finally this is a little off to me
<div id="demo" dynamic="no" limit="1">
</div>
"dynamic" and "limit" only work on ExpressionEngine {exp:channel:entries} tags, not regular HTML elements (like DIVs). I would try using Bitmanic and Peter's suggestion again, but apply it to {exp:channel:entries} like so:
{exp:channel:entries channel="blog_sidebar" dynamic="off"}
...
{/exp:channel:entries}
If you're new to ExpressionEngine I highly recommend videos & tutorials by Ryan Ireland http://eeinsider.com/videos
I did some searching around but I can't seem to find any information on embedding a channel entry tag pair within another.
When I try the following code in a template, it breaks the page and I see the opening {reverse_related_entries sort="desc"} displayed as plain text:
{exp:channel:entries channel="pages"}
{reverse_related_entries sort="desc"}
{if show_testimonial}
{exp:channel:entries channel="testimonials" orderby="random" limit="1"}
<blockquote>
{testimony}
<cite>
<span class="cite_name">{cite_name}</span><br />
<span class="cite_org">{cite_org}</span><br />
<span class="cite_title">{cite_title}</span>
</cite>
</blockquote>
{/exp:channel:entries}
{/if}
{/reverse_related_entries}
{/exp:channel:entries}
Is there a way in ExpressionEngine to nest a channel entry tag pair inside itself?
In order to nest a {exp:channel:entries} tag pair inside of itself, you'll need to embed the template within another template using an {embed} variable.
To do so, just modify your main channel entries tag to look like the following:
{exp:channel:entries channel="pages"}
{reverse_related_entries sort="desc"}
{if show_testimonial}
{embed="template_group/template"}
{/if}
{/reverse_related_entries}
{/exp:channel:entries}
Then, create a new template with the contents of your nested channel entries tag pair:
{exp:channel:entries channel="testimonials" orderby="random" limit="1"}
<blockquote>
{testimony}
<cite>
<span class="cite_name">{cite_name}</span><br />
<span class="cite_org">{cite_org}</span><br />
<span class="cite_title">{cite_title}</span>
</cite>
</blockquote>
{/exp:channel:entries}
Which you can include in any ExpressionEngine template using the following syntax, as shown earlier:
{embed="template_group/template"}
Using embed templates are a standard way around some of ExpressionEngine's quirks and Parse Order (PDF, 32 KB), but they do carry a performance penalty with them so be mindful in deciding between using an {embed} and a {snippet}.