We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

NEW - Redirect Plugin…

Development and Programming

Andy Harris's avatar
Andy Harris
958 posts
17 years ago
Andy Harris's avatar Andy Harris

I’m delighted to say that it wasn’t because I’d missed that underscore because right now I would be feeling unbelievably foolish.

And I’m equally delighted to confirm that the include method works fine too so that’s perfect for this particular need. Thanks lots and indeed ‘doozazzle’.

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen
I’m delighted to say that it wasn’t because I’d missed that underscore because right now I would be feeling unbelievably foolish.

😉

And I’m equally delighted to confirm that the include method works fine too so that’s perfect for this particular need. Thanks lots and indeed ‘doozazzle’.

No problem at all. Well done on the doozazzle. Sorry if I bored you with what was above it? Let’s not give the game away to everyone in the forums though!! 😉

Best wishes,

Mark

       
leeaston's avatar
leeaston
634 posts
17 years ago
leeaston's avatar leeaston

Hi Mark, didn’t know where to post my question about you wiki article (Redirect User Upon Logging In) as I wasn’t able to post a question on the wiki. I’m having a problem where FireFox isn’t redirecting to the url specified in the cookie. Was wondering if this is a know problem?

Wiki article: http://expressionengine.com/wiki/Redirect_User_Upon_Logging_In/

Best wishes Lee

       
genehil's avatar
genehil
23 posts
17 years ago
genehil's avatar genehil

Mark:

I’m attempting to build a simple search that would accomplish the following:

Keyword is not found - send to “keyword not found” page.

Keyword is found - redirect browser to the value stored in the “keyword_url” field.

I can get the search to return the “keyword_url” value with no problems… all by itself by using this code:

{exp:search:search_results}{keyword_url}{/exp:search:search_results}

And, I can get your plugin to work just fine placing a simple URL into it -

{exp:redirect_to location="www.yahoo.com"}

However, if I attempt to combine the two by placing the keyword_url inside the plugin I get an invalid URL:

{exp:redirect_to location="{exp:search:search_results}{keyword_url}{/exp:search:search_results}"}

The Invalid URL is:

http://www.panhandleparade.com/index.php/keywords/results/f4c187fcd506cbc4692df65e5bbe434a/{exp:search:search_results}{keyword_url}{/exp:search:search_results}

I’m guessing the EE code to extract the “keyword_url” value is not working inside the plugin code…

The simple search page is here: http://www.panhandleparade.com/index.php/keywords/simple_search/

The single good keyword in the system at this time is “bagpipes” and the keyword_url is http://www.bagpipes.com

(I’m not into bagpipes, it’s just what I chose to test with)

Any thoughts?

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hiya,

Sorry I am probably being dense here but where exactly is this {keyword_url} you are talking about coming from. I don’t see it listed in the documentation for search results?

Best wishes,

Mark

       
genehil's avatar
genehil
23 posts
17 years ago
genehil's avatar genehil

Sorry Mark… the “keyword_url” is just the name of the field I made for the weblog I made whose name is “keywords”.

Basically - I have a weblog named “keywords”.

In that weblog, I have two fields, the default (title) field and a field I generated for this weblog called “keyword_url”.

I can get a Simple Search form to search for a keyword - looking in the title fields of the keyword weblog.

If the Simple Search does not the find word that was searched for, it will send me to the “Not Found” page…. but if it does find the keyword I submitted in the title field of any of the entries in my keyword weblog, it will display the information in the “keyword_url” field of that “found” entry in the results page.

I can get the simple search to “find” my bagpipes entry… and I can get it to then display the information in the “keyword_url” field… but what I’d like it to do is - instead of display the url in the keyword_url field - I’d like it to redirect the browser to that URL.

gh

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hiya,

Ah I see what you are trying to do now! Is this for some sort of link directory or something?

I don’t think that the plugin I have made is going to work for this. I did try using it within {if} statements myself the once but it just went with whatever was in the first {if} statement regardless of the outcome. I don’t really have enough knowledge of the system to put together a plugin of that nature I’m afraid and what I have put together is quite simple in that respect.

Do you have to have the person automatically re-directed to the page stored in {keyword_url}? I only ask as I know that a lot of people on the net don’t like to be automatically taken away from a site without being told about it first, but I guess that’s another thing to look at.

Sorry I can’t be of more help but I don’t think that in this instance the plugin is going to do what you need it to. I would love to be proven wrong by one of the learned people in here who know much more about the plugin development side of things than me though so please please please developers bring on the ideas 😊

Once again sorry I couldn’t be of more help on this for you.

Hope you get something sorted out though for this.

Best wishes,

Mark

       
genehil's avatar
genehil
23 posts
17 years ago
genehil's avatar genehil

No sweat, Mark… I sure do appreciate your look-see on this one.

I am looking for a direct “redirect” on our keyword search. I work for a TV station and they are big into keywords.

We’ve been sold and I’m building out a prototype site that we can move to for all our stuff… and the keyword is one thing in the mix that I’ve gotta figure out.

If I can’t figure it out - a direct redirect - I’ll figure out the next best thing.

Again… thanks for your efforts here.

gh

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Hiya,

Sorry that I couldn’t be of more help on this one. Perhaps you could ask one of the EE development team in here to take a look at my plugin? Well actually don’t bother as they could probably write one up in about half a second but you have my permission to gladly get in touch with them and ask questions about how to extend this plugin to do what you need. I’m sure they could be of help on this one but it is just a little too deep into code for me I’m afraid.

Do keep me in on the loop if you do come up with anything on this plugin as would love to see anything that gets modified.

Hope you get it all sorted soon.

Best wishes,

Mark

       
genehil's avatar
genehil
23 posts
17 years ago
genehil's avatar genehil

I ended up setting up a simple script that finally worked:

<sKript>
windoZe.location="{exp:search:search_results}{keyword_url}{/exp:search:search_results}";
</sKript>

Now, if you put “bagpipes” in the Simple Search - you will be redirected to bagpipes.com right away… This should hold the big guys off for a while…

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Excellent news!

Glad you got it all sorted.

Best wishes,

Mark

       
Andy Harris's avatar
Andy Harris
958 posts
17 years ago
Andy Harris's avatar Andy Harris

I’m trying this:

{exp:weblog:entries weblog="casestudy" disable="member_data|trackbacks" limit="8" orderby="title" sort="asc" paginate="bottom"}
    {if total_results == 1}
        {exp:redirect_to location="http://example.com/casestudy/{categories show_group="4"}{category_url_title}{/categories}/{url_title}/"}
    {/if}
{/exp:weblog:entries}

And Firefox is telling me:

Firefox has detected that the server is redirecting the request for this address in a way that will never complete.

Any idea what could be happening here?

//EDIT - hold fire, just spotted the quotes around 4…

       
Andy Harris's avatar
Andy Harris
958 posts
17 years ago
Andy Harris's avatar Andy Harris

No, I just can’t get this to work at all…don’t suppose anyone has any suggestions, I basically need to redirect (including a category name) if there’s only one result present.

       
tpayton's avatar
tpayton
172 posts
17 years ago
tpayton's avatar tpayton

Andy - This might help you. We were having trouble with the redirect plugin also so we ended up using some javascript. This paticular bit of code checks to see if a logged in person is of a certian member group, and then checks to see if the {segment_3} variable is equal to a custom_profile field called {pebble_group}.

Anyway, is seems pretty fullproof even though it is deeply nested, which is I think why the Redirect Pluggin is not working.

{if member_group != "1"}

  {exp:member:custom_profile_data}

     {if {pebble_group} !="{segment_3}"}
     
     [removed].href="http://www.domain.org/pebblegroup/";
     {/if}

  {/exp:member:custom_profile_data}

{/if}
       
Andy Harris's avatar
Andy Harris
958 posts
17 years ago
Andy Harris's avatar Andy Harris

Thanks for that. I had to go with javascript also as I couldn’t get a PHP redirect to work due to not being able to put it in the header. I find it amazing that something as simple as this isn’t straightforward in PHP!

       
1 2 3 4 Last

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.