2 of 2
2
Plugin: Cookie Plus
Posted: 03 September 2008 11:47 PM   [ Ignore ]   [ # 19 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  284
Joined  02-02-2007

I am using the retrieve info within an include that is embedded within the page.

I’m not sure I understand correctly what you mean here. Can you post the code?

I tried the code you posted and found that included in usual template it works correctly.

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
Posted: 04 September 2008 07:27 AM   [ Ignore ]   [ # 20 ]  
Summer Student
Avatar
Total Posts:  3
Joined  08-03-2007

Ok here goes. smile

My current website is http://www.reeb.com/index.php/index/ which shows product info for EAST location.

I am being asked to create a second web page that will highlight WEST coast product info http://www.reeb.com/index.php/indexWest/

My header and navigation along with other elements on the page are created using includes/embeds http://expressionengine.com/docs/templates/embedding_templates.html

I want the REEB logo and the HOME button to link to the home page of EAST when the user has selected EAST and WEST when the user has selected WEST.

My branding include code:

<div id="branding">
<
a name="top" id="top"></a>
{exp:cookie_plus:get name="mylocation"}
{if cookie
=="west"}
<a href="http://www.reeb.com/index.php/indexWest/"><img src="/images/branding/reebLogo.jpg" alt="" name="reebLogo" width="271" height="59" border="0" id="reebLogo" /></a>
{if:else}
<a href="http://www.reeb.com/index.php/index/"><img src="/images/branding/reebLogo.jpg" alt="" name="reebLogo" width="271" height="59" border="0" id="reebLogo" /></a>
{/if}
{
/exp:cookie_plus:get}
</div>

My page code:

{exp:cookie_plus:set name="mylocation" value="west" seconds="0"}

{assign_variable
:pageTitle="REEB | Welcome to REEB"}
{assign_variable
:pageHeader="Home"}
{assign_variable
:pageID="home"}
{assign_variable
:css_style="home"}

{assign_variable
:my_template_group="weblog"}

{embed
="includes/doc_type"}

<head>

{embed="includes/metadata"}

<title>{pageTitle}</title>

{embed="styles/{css_style}"}
{embed
="includes/javascript"}

</head>
<
body id="{pageID}">
{embed="includes/login"}
{embed
="includes/select_location"}
<div id="container">
{embed="includes/branding"}[color=red]<!-- branding included here -->[/color]
  
<div id="navSubWrapper"> {embed="includes/subNav"} </div>
  <
div id="navMainWrapper"> {embed="includes/mainNav"} </div>
  <
div id="content">
    <
div id="contentMain">
      <
div id="highlightWrapper">
        <
div id="highlightContent">
          <
div id="left"><!-- Highlight left image BEGIN -->
              
{exp:gallery:entries gallery="highlight_banner_3" category="39" orderby="random" limit="1" dynamic="off"}
                          
<a href="{custom_field_one}"><img src="{image_url}" width="{thumb_width}" height="{thumb_height}" alt="{title}" title="{title}" /></a>
              
{/exp:gallery:entries}
          
</div><!-- Highlight END -->
          <
div id="right"><!-- Highlight right image BEGIN -->
               
{exp:gallery:entries gallery="highlight_banner_2" category="11" orderby="random" limit="1" dynamic="off"}
                           
<a href="{custom_field_one}"><img src="{image_url}" width="{thumb_width}" height="{thumb_height}" alt="{title}" title="{title}" /></a>
               
{/exp:gallery:entries}
          
</div><!-- Highlight END -->
        </
div>
      </
div>
      <
div id="pageTitle">
      </
div>
      <
div id="mainTextWrapper">

      <
div id="newProducts">
      <
h2>New Products</h2>
       
{exp:weblog:entries weblog="weblog" category="27" orderby="date" sort="desc" limit="5" disable="trackbacks"}
       
       
<div class="productHighlightImage"><img src="{image}" width="230" height="36" alt="{title}" /></div>
       <
ul>
            <
li> <a href="{permalink="><span class="yellow">{title}</span></a></li>
       </
ul>
             <
p>{summary}</p>
       <
a href="{permalink=">Read More</a><br/><br/>
       <
div class="hr" align="center"><img src="/images/layout/hr.jpg" alt="" /></div>  
       
{/exp:weblog:entries}
       
</div>
  
      <
div id="spotlight">
       <
h2>Spotlight</h2>          
       
{exp:weblog:entries weblog="weblog" category="25" orderby="date" sort="desc" limit="3" disable="trackbacks"}<br/>
       
{title}<br/>
       <
img class="image" src="{image}" width="145" height="100" alt="" />    
       
{summary}
       
<h4>{comment_total} comments // {entry_date format="%F %d, %Y"}</h4>
       
<p><a href="{permalink=">Read More</a></p>
       <
div class="hr" align="center"><img src="/images/layout/hr.jpg" alt="" /></div>
       
{/exp:weblog:entries}
       
</div>
       
       <
div id="highlightColumn"> <!-- Highlight Column BEGIN -->
        
        
{embed="includes/product_categories"}
        
<div id="newsHighlight">
    <
h2>Latest News</h2>
         <
ul>         
             
{exp:weblog:entries weblog="weblog" orderby="date" sort="desc" limit="5" disable="trackbacks" dynamic="off"}
                     
<li><a href="{permalink=">{title}</a><br/><h4>// {entry_date format="%F %d, %Y"}</h4></li>
             
{/exp:weblog:entries}
         
</ul>
    <
a href="http://www.reeb.com/index.php/weblog/">View All</a>
</
div>
        
{embed="includes/newest_media"}
        
        
</div><!-- Highlight Column END-->
    </
div>
</
div>

{embed="includes/manufacturer_scrolling_logos"}
{embed
="includes/site_info"}

</div>

{embed="includes/footer_javascript"}

</body>
</
html>

Like I said i’m new to this stuff, maybe this is not the best way to achieve this??

Profile
 
 
Posted: 04 September 2008 09:59 AM   [ Ignore ]   [ # 21 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  284
Joined  02-02-2007

Hi cicconedesign,

It is irrelevant that the code that sets the cookie is on the main template and the code that reads the cookie is on embedded template. Both setting cookie and reading it should work. That is, the first time you load the page cookie will be set, the second time and so on cookie will be both set and retrieved. If it does not work this way for you I have no idea what might be the cause.

maybe this is not the best way to achieve this??

Really, it is wrong way to achieve functionality you need, because the right link will be displayed only starting from the second load of the page. You would better use URL segment variables. The code would be as follows:

{if segment_1=="indexWest"}
<a href="http://www.reeb.com/index.php/indexWest/"><img src="/images/branding/reebLogo.jpg" alt="" name="reebLogo" width="271" height="59" border="0" id="reebLogo" /></a>
{if:else}
<a href="http://www.reeb.com/index.php/index/"><img src="/images/branding/reebLogo.jpg" alt="" name="reebLogo" width="271" height="59" border="0" id="reebLogo" /></a>
{/if}

 Signature 

Full list of plugins here

Child Categories
Browser Sniff
Category Id
Entries List

Profile
 
 
Posted: 04 September 2008 10:21 AM   [ Ignore ]   [ # 22 ]  
Summer Student
Avatar
Total Posts:  3
Joined  08-03-2007

Thanks Laisvunas!

I used the URL Segment Variables as you suggested. It works great.

Thanks again. smile

Profile
 
 
Posted: 27 September 2008 10:21 AM   [ Ignore ]   [ # 23 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  248
Joined  12-11-2002

w00t!

thank you for this. solved a problem in testing for presence of a cookie inside a {body} tag with {exp:allow_eecode}

Profile
 
 
   
2 of 2
2
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64907 Total Logged-in Users: 38
Total Topics: 81852 Total Anonymous Users: 34
Total Replies: 440056 Total Guests: 241
Total Posts: 521908    
Members ( View Memberlist )