Elxis CMS Forum

Support => Technical support => Topic started by: elpvn on December 22, 2009, 15:07:01

Title: How to redirect for first time only?[SOLVED]
Post by: elpvn on December 22, 2009, 15:07:01
Hi everyone,

For advertising reason, I want to put an ads page on first time for anyone enter my website (powered by Elxis CMS). So how to create a redirect page (code or script) on first time enter the site? (just show at the first time for each section only)

Thanks for help and support.
Title: Re: How to redirect for first time only?
Post by: ks-net on December 22, 2009, 18:34:48
in your template's  index.php inside <body>


try this

Code: [Select]
<?php if (($_SESSION[&#39;flashintro&#39;] != 1) && ($option == &#39;com_frontpage&#39;)) {
$_SESSION[&#39;flashintro&#39;] = 1;
?>

    <div id="overlayflash">
    <object type="application/x-shockwave-flash" data="http://www....../intro.swf" width="900" height="900">
    <param name="movie" value="http://www......../intro.swf" />
    <param name="wmode" value="opaque">
    </object>
    </div>
<?php ?>

we don't set a redirection... it is better for seo optimization  to set an overlay div (properly css customized) to float above

and here is the css example:

#overlayflash {
width:100%;
height:1900px; /*higher than current page height*/
background:#FFFF00!important;
z-index:99999;
position:absolute;
top: 0; right: 0; bottom: 0; left: 0;
text-align:center;
}

EDIT:
You must know that search engines might give a penalty to your site if ...
1- your site redirects visitors to other pages once reaching your site
2- you are showing to visitors other content  than what the search engine actually sees!


Title: Re: How to redirect for first time only?
Post by: elpvn on December 22, 2009, 22:20:11
Thanks Ks-net,

Great idea! But it not work on my website T_T

Maybe still missing something?

Thanks again :)
Title: Re: How to redirect for first time only?
Post by: ks-net on December 22, 2009, 22:33:50
which part fails?

flash
css
session
Title: Re: How to redirect for first time only?
Post by: elpvn on December 23, 2009, 01:17:36
Hi,

Maybe session? I think so :)

Great support ^^
Title: Re: How to redirect for first time only?
Post by: ks-net on December 23, 2009, 02:31:02
i think it is most likely the odject.. flash paths etc...

test first your session...

eg.

Code: [Select]
<?php if (($_SESSION[&#39;flashintro&#39;] != 1) && ($option == &#39;com_frontpage&#39;)) {
$_SESSION[&#39;flashintro&#39;] = 1;
?>

    <div >
    <h1>hello world</h1>
    </div>

<?php ?>

remember.. only at home page and only one time it will appear the "hello world" text... in next reload-visit it will disappear,

to test it again you have first to clear-reset your stored session => clear browser cookies or close-reopen browser.

edit:
all above code and examples .. are real working examples... they are  working online at this time!

Title: Re: How to redirect for first time only?
Post by: elpvn on December 23, 2009, 08:05:33
Hello ks-net,

Well, it's still not work at me, but  easier to visualize, your can visit this site as an example:

http://vozforums.com/ (http://vozforums.com/)

You will see that in first time enter the site: http://vozforums.com/ then this site will be redirects to http://vozforums.com/specials/intro.php?next=%2F (http://vozforums.com/specials/intro.php?next=%2F) (an advertising page) but in next reload/visit it will disappear. Is a commercial script or not? How to get it to work on my personal site (powered by Elxis CMS)? Maybe help me a full code/script with this feature?

Special thanks for help and continous support :)

e l p

Title: Re: How to redirect for first time only?
Post by: nik160 on January 12, 2010, 16:15:52
εχω το εξης πρόβλημα στην γραμμή "<?php if (($_SESSION['flashintro'] != 1) && ($option == 'com_frontpage')) {" .
όταν βάζω και το δεύτερο "όρισμα" με το con_frontpage δεν εκτελείται καθόλου η εντολή. υπάρχει κάποιος άλλος τρόπος να μπορώ να εκτελώ τις εντολές μέσα στο if χωρίς το con_frontpage αλλά για την πρώτη φορά που μπαίνει κάποιος στο site? ευχαριστώ...
Title: Re: How to redirect for first time only?
Post by: ks-net on January 13, 2010, 08:46:17
please write in English in this topic(modify-translate or move your post to greek section)

<?php  if  ($_SESSION['flashintro'] != 1)  {
$_SESSION['flashintro'] = 1;
?>
    <div >
    <h1>hello world</h1>
    </div>

<?php } ?>


******
Quote
Hello ks-net,

Well, it's still not work at me, but  easier to visualize, your can visit this site as an example:
you insist on redirecting to an html page but my method is only placing an overlay div
maybe you don't have com_frontpage as first page but other page?
try this to check:
<?php if ($_SESSION['flashintro'] != 1)  {
$_SESSION['flashintro'] = 1;
?>
    <div >
    <h1>hello world</h1>
    </div>

<?php } ?>
Title: Re: How to redirect for first time only?
Post by: nik160 on January 14, 2010, 15:21:40
yes that was it ! instead of con_frontpage I have con_reservations !


solved ! thanks
Title: Re: How to redirect for first time only?
Post by: webgift on January 20, 2010, 20:13:39
Kostas please rename this subject as SOLVED!  ::) 8)
Title: Re: How to redirect for first time only?[SOLVED]
Post by: nik160 on February 02, 2010, 10:57:51
Hi, I have this code in my site
--------------------------------
<?php if (($_SESSION['flashintro'] != 1) && ($option == 'com_reservations')) {
$_SESSION['flashintro'] = 1;
?>
    <div id="overlayflash">
       <iframe src="<?php echo $mainframe->getCfg('ssl_live_site'); ?>/main-index.html" width="100%" height="1000" frameborder="0" > </iframe>
    </div>
<?php } ?>
-----------------------------
it's working, but there is one problem. When I wanna browse i.e. this site http://www.ibooking.gr/reservations/zagorohoria/ksenodokheio-ntobra.html it's still for the first time appears the splash screen. I want to appear the splash screen only when someone browse -for the first time- this site http://www.ibooking.gr/ not all "sections" of com_reservations..

thanks