close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Serve content based on Session Variable HELP

Thread began 12/17/2010 10:25 am by Heckie | Last modified 12/20/2010 10:27 am by Jason Byrnes | 1444 views | 3 replies |


Serve content based on Session Variable HELP

I am building a website for a client who sells heating components.

I am looking to serve slightly different content on the pages of my site depending on if people are one of 3 groups - consumer, landlord or installer.

On my home page - there are 3 tabs, each with its own 'more' button. (3 tabs / 3 more buttons).

What I would like to do is set a session variable (ContentType) to enable me to show the correct content for each group.

Then on each page I'm going to set up variables that use 'IF ContentType = x'

I would also like the session to be reset every time someone visits the home page.

Im thinking that I need to wrap each home page tab inside a form, but maybe theres a better way?

Sign in to reply to this post

Jason ByrnesWebAssist

you would need to use if statements to choose which content to serve:

<?php if(isset($_SESSION['ContentType']) && $_SESSION['ContentType'] = "1") { ?>
show content for content type equals 1
<?php } ?>

you could use the following code to unset the session:
<?php if(isset($_SESSION['ContentType'])) unset($_SESSION['ContentType'])); ?>

Sign in to reply to this post


Thanks Jason.

How do I set the session variables in the first place? On my home page - there are 3 tabs, each with its own 'more' button. (3 tabs / 3 more buttons).

Each click should set a session variable:

Consumer - 1
Housing Associations - 2
Installers - 3

Does each one need its own FORM?

Sign in to reply to this post

Jason ByrnesWebAssist

each button would link to a page passing a querystring variable:
<a href=""page.php?ContentType=1">Consumer</a>
<a href=""page.php?ContentType=2">Housing Associations</a>
<a href=""page.php?ContentType=3">Installers</a>

the on page.php use the set session variable server behavior to set the session using the ContentType querystring.

First go to the bindings panel and click the plus button, select URL Variable and name it ContentType.

Then on the server behavior panel, click the plus button and select eCart -> General -> Set Session Variable. For the trigger, click the lightning bolt, and select the ContentType URL Variable, do the same for the value, and set the name to ContentType

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...