Confirmation of Age for 'Adult' category?

Discussion in 'Technical Support' started by michael, Jun 3, 2009.

Thread Status:
Not open for further replies.
  1. michael Just get on with it!

    I have one adult category and I'd like users to simply click a confirmation that they are 18 years of age or over. Creating that page is easy enough as is having the user subsequently forwarded to the adult category, what I'm unclear about is how to have users directed to the new confirmation page on clicking 'Adult'.

    Hope that lot makes sense.
  2. Eric Barnes Guest

    I would probably edit the category.php file and just under the slug if statement add something like:
    PHP:

    if($slug=='adult') { // category uri
        
    if(!isset($_COOKIE['valid']) {
            
    //no cookie so put redirect here.
        
    }
    }
    Then set a cookie when they approve it.
  3. Lhotch curmudgeon

    I would start by looking at a place where the system already forwards you and duplicate it.

    For example look at login.php you can see the following....

    $class_tpl->assign('title',LANG_LOGIN_SUCCESS);
    $class_tpl->assign('forward',TRUE);
    $class_tpl->assign('location',$location);
    $class_tpl->assign('body','forward.tpl');

    You can see a location is specified and the template forward.tpl is displayed so open and take a peek in there. You should be able to easily create your adult check page to assign template variables and call up forward.tpl and it should handle the rest.
  4. michael Just get on with it!

    Thank you both. I know nothing about writing cookies but will do some research. Larry's approach makes sense but seems to involve a bit more work . . .

    Hmmmm
  5. ronin Customer

    Any news about that?

    I need that features me too!

    Any help?
  6. ronin Customer

  7. michael Just get on with it!

    Well done ronin! That's exactly what I need - and it was a pleasure to check out your site :D.

    Any chance you could post the code here?

    Michael
  8. ronin Customer

    Well, basically I used the code you can find here:
    Dynamic Drive DHTML Scripts- Interstitial Content Box

    (you have to modify the js and css file to give them abolute path to your web site..)

    The I place in the HEAD section of layout template this code:
    Code:
    <!-- start disclaimer -->
    {if $categoryname == "category name where you need disclaimer"}
    <link rel="stylesheet" type="text/css" href="http://www.YOUR-WEB-SITE-ADDRESS.com/disclaimer/interstitial.css" />
    {literal}<script type="text/javascript" src="http://www.YOUR-WEB-SITE-ADDRESS.COM/disclaimer/interstitial.js"></script>{/literal}
    {elseif $categoryname == "another category name where you need disclaimer - 02"}
    <link rel="stylesheet" type="text/css" href="http://www.YOUR-WEB-SITE-ADDRESS.COM/disclaimer/interstitial.css" />
    {literal}<script type="text/javascript" src="http://www.YOUR-WEB-SITE-ADDRESS.COM/disclaimer/interstitial.js"></script>{/literal}
    {elseif $categoryname == "another category name where you need disclaimer - 03"}
    <link rel="stylesheet" type="text/css" href="http://www.YOUR-WEB-SITE-ADDRESS.COM/disclaimer/interstitial.css" />
    {literal}<script type="text/javascript" src="http://www.YOUR-WEB-SITE-ADDRESS.COM/disclaimer/interstitial.js"></script>{/literal}
    
    {else}
    
    {/if}
    <!-- end disclaimer -->
    
    Basically, it check IF the user in IN a category where you need a disclaimer.
    IF the category name is in the list, then disclaimer is showed.

    There is one BIG problem with that.
    Cookies is set as soon you are showed the disclaimer, even if you choose to "return" to home page (that is: example, you click: NO, I DON'T WANT TO ENTER).
    So, if you later return to an adult category disclaimer IS NOT showed again.

    Anyway, with this script, you can choose the frequency, so you can set to: every page is loaded, every browser session (the ones I choose), or every X days.

    Write again if you need other help!
Thread Status:
Not open for further replies.

Share This Page