Hi Andy,
Here is another piece of code which also should achieve what you want:
{if segment_1 == ""}
{exp:weblog:entries weblog="home" dynamic="off" disable="member_data|trackbacks" limit="1"}
//do some stuff
{/exp:weblog:entries}
{if:else}
<!--GET ALL CASESTUDIES BASED ON CURRENT PAGE-->
{exp:weblog:entries weblog="casestudy" disable="member_data|trackbacks"}
<!--IF THERES ONLY ONE RESULT...-->
{if total_results == 1}
<!--...REDIRECT TO THE ACTUAL CASESTUDY PAGE-->
{exp:redirect_to location='/casestudy/{categories show_group="4"}{category_url_title}{/categories}/{url_title}' method="script"}
{/if}
{/exp:weblog:entries}
{/if}
Ahha, I see what I did. That works, thanks muchly….however the problem I have now is that I don’t want to use a javascript redirect if I can help it.
If I remove the method=”script” section, it redirects regardless of total_results. As this chunk of code is at the top of the page before (as far as I can tell) any header information is written, I would have thought I could do a PHP redirect. :(
Right then. I have just uploaded the newest version of this to the first post and I have to make a public apology on the forums here to Laisvunas. He did a lot of work on this plugin adding in the new features and I went and added them into the plugin but forgot to upload it to the thread so for that I really do apologise.
Hopefully I have done it all correct and it should work as advertised. I will leave the original plugin in the first thread as well though just in case I have coded anything wrong. It’s just after 1 here and I am just a little bushed now!! 😉
Best wishes,
Mark
I’m trying to use this to forward certain members to an alternative start page, but i’m having the problem mentioned here before that it forwards if the conditional is met or not. Any ideas how to fix this?
{if member_group=="1" OR member_group=="5" OR member_group=="6"}
{exp:redirect_to location="http://www.example.com/index.php/blog/"}
{/if}
Hi baboonbrand, Since ExpressionEngine’s version 1.6.5 in which {redirect="template/template_group"} was made global there is no need to use Redirect To plugin to achieve redirection.
Thanks for heads up! Some of my clients need this functionality now, and the process for upgrading the core software is a bit lengthy, so this solution is perfect albeit temporary 😊
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.