|
In this recipe we show a particular module to a user only once, then cookie their browser. The MetaMod picks up that cookie on the next page (or time) they visit, and won’t show the module again. (See also Show a Module Once Per Session)
Show the module only on the very first page, and never again:
$c = JRequest::getInt('SeenIt', 0, 'cookie');
if ($c) return; /* if cookie was set, don't show anything, else... */
setcookie( 'SeenIt', 1, time()+60*60*24*365*10, '/' );
return 101; /* return module 101, but only the first time */
Don’t show the module on the first page they visit, but show it on every subsequent page and visit:
$c = JRequest::getInt('SeenIt', 0, 'cookie');
if ($c) return 101; /* if cookie was set, show module 101 */
setcookie( 'SeenIt', 1, time()+60*60*24*365*10, '/' );
return; /* don't return anything the first time. */ |