ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Simple URL segment (state) stopped working

April 22, 2011 11:02pm

Subscribe [3]
  • #1 / Apr 22, 2011 11:02pm

    handyman

    509 posts

    1.7
    Been working for years, although I didn’t check it in the last couple of updates…...

    {exp:weblog:entries weblog="wood_pellets_prices" state = "{Segment_3}" }

    This is a fuel price guide where people enter a location that pellets were purchased, and then others can list them by state using a drop down. The state is the last segment of the URL..
    http://www.hearth.com/econtent/index.php/fuels/showstatewoodpellets/MA/

    I tried some simple things like using== and changing to last_segment, no go…....

    Any known issues with segment searching? I do get data returned, but it is not the state I am looking for….just random states.

  • #2 / Apr 23, 2011 11:13am

    giusi

    94 posts

    Are you talking about dynamic parameters ? Personally I have never seen the {channel:entries} tag used with custom parameters (like “state” in your example). But maybe I am missing something.

    Edit: also I can’t register to your site the sign up page doesn’t work.

  • #3 / Apr 23, 2011 11:41am

    handyman

    509 posts

    Oops =You can surely register - EE does not suggest that the registration page use their default format - since spammers tend to use that one! I have to change it at that page!
    http://www.hearth.com/econtent/index.php/forums/ - register on top, etc….

    as far as the tag, it was done for me by an outside party (EE expert)  a couple years ago and has worked fine…...

  • #4 / Apr 23, 2011 11:50am

    giusi

    94 posts

    as far as the tag, it was done for me by an outside party (EE expert)  a couple years ago and has worked fine…...

    He probably altered the {channel:entries} tag files to add the state parameter. If you upgraded the site the files had been overridden and you lost the custom features. As general rule altering the core files is not the best way to add new features. Do you have a backup of the old files? Maybe you can reapply the customization.

    I think you can accomplish the same beahvior using the dynamic parameters i mentioned in the previous post (obviously you’ll need to redo most of the code).

  • #5 / Apr 23, 2011 1:57pm

    handyman

    509 posts

    Thanks for the help….I’ll ask the developer if she altered the core module!

  • #6 / Apr 23, 2011 4:40pm

    Greg Salt

    3988 posts

    Hi Craig,

    Guisi’s analysis does seem like it might be correct. Do you have a backup from the working version?

    Cheers

    Greg

    @guisi, thanks very much for your help.

  • #7 / Apr 23, 2011 5:52pm

    handyman

    509 posts

    I’m sure I do, but modifying the core might not be the way to go - can’t imagine fixing that on every upgrade!

    I’ll have to rewrite as suggests…so as to be workable in current and in 2.x versions with less changes!

  • #8 / Apr 24, 2011 4:29pm

    Greg Salt

    3988 posts

    Hi Craig,

    Can you please post the full weblog:entries tag so that I can see what the full thing is doing?

    Cheers

    Greg

  • #9 / Apr 24, 2011 5:13pm

    handyman

    509 posts

    {exp:weblog:entries weblog="wood_pellets_prices" state = "{Segment_3}" }
     
    {title}  by: {author} on - {entry_date format='%m/%d/%Y'} 
    <strong> Price: </strong>${price} per {unit}</strong> at {suppliername}
    {if street_address} {street_address}
    {/if}
    {if city}{city},{/if} {state} {if zip} {zip}{/if}{if country} {country}{/if}
    {if comments}
    
    Comments: {comments}
    {/if}
    {paginate}
    Page {current_page} of {total_pages} pages {pagination_links}
    {/paginate}
    <hr >
    
    {/exp:weblog:entries}

    Basically, it searches a weblog that is wood pellet prices based on the state code…..which I think is passed along to this in a URL by another script.
    Oops. maybe that other script holds the key here!
    Again, I have changed nothing since it did work back when…

    <form name="statemenu" action="}">
    <select name="selstate">
    <option value="">-- Choose a State--</option>
    {exp:query sql="select distinct field_id_17 as statename from exp_weblog_data where field_id_17 > '' and weblog_id='13' order by statename asc"}
    <option value="{path=fuels/showstatewoodpellets/{statename}}">{statename}</option>
    {/exp:query}
    
    </select>
    </form>

    So maybe I should check that those field_ids are all the same…or maybe mysql changed a bit from the 4 version I was using back then to the 5 now?

    Oh, that part works….I guess, because it builds the list of state names from the db. It’s just that they don’t actually search when you select them…..oh well

  • #10 / Apr 24, 2011 5:50pm

    Greg Salt

    3988 posts

    Hi Craig,

    It does seem as if the state parameter should be changed to a search one. If the state selection form works then using the search parameter should work properly.

    Cheers

    Greg

  • #11 / Apr 24, 2011 6:42pm

    handyman

    509 posts

    Well, that seems to make it work!

    {exp:weblog:entries weblog="wood_pellets_prices" search:state = "{segment_3}" }

    Strange, but I learned long ago not to ask questions…..about the past! Once it works, it works!
    (at least for now)....

    Thanks…..

  • #12 / Apr 24, 2011 10:49pm

    Lisa Wess

    20502 posts

    Hey Craig,

    Glad you got it working!  Do note that really, the proper syntax is:

    search:state="{segment_3}"

    See how I removed those spaces?

    In any case - if anything else comes up, please do let us know!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases