Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Displaying define_main.page.php only once

Displaying define_main.page.php only once

Locked

Views: 2,127

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
12 Sep 2006, 8:47 PM
#1
mdmerrell avatar

mdmerrell

New Zenner

Join Date:
Nov 2005
Posts:
14
Plugin Contributions:
0

Displaying define_main.page.php only once

I am looking for help with the displaying of the define_main_page.php. I’ve added a flash file to my define_main_page.php and would like to set a condition that the define_main_page.php only display on the initial entry of my website. That is if you go to other pages within the site and back to the main page the define_main_page.php won’t display, so to not run the flash file again.

Any help and suggestions would be greatly appreciated!

Thanks!

13 Sep 2006, 12:57 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Displaying define_main.page.php only once

You could look in the /includes/init_includes/init_special_funcs.php

There is a section that only runs once per session ...

Add inside the IF statement:

if (isset($_SESSION['updateExpirations']) && $_SESSION['updateExpirations'] === true) {

a session variable of your own:

$_SESSION['run_flash'] = true;

Then, where you want to run your flash on first hit, place it inside an IF statement:

if ($_SESSION['run_flash'] == true) {
  $_SESSION['run_flash'] = false;
  // do flash stuff
}

Now it runs once per session ...

13 Sep 2006, 12:57 AM
#3
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Displaying define_main.page.php only once

NOTE: when testing ... remember it runs once per session ... :smartass:

19 Sep 2006, 5:41 PM
#4
mdmerrell avatar

mdmerrell

New Zenner

Join Date:
Nov 2005
Posts:
14
Plugin Contributions:
0

Re: Displaying define_main.page.php only once

Thanks for your response, however I can’t find /includes/init_includes/init_special_funcs.php. I’m running Zen Cart 1.2.5. Do I need to upgrade to the latest version to find this file.

-Mike M.

20 Sep 2006, 3:47 AM
#5
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Displaying define_main.page.php only once

v1.2.5!! Do you know how old that code is? :eek:

I don't even remember that code it is so old ... :no:

The information I gave you doesn't exist in those files as they don't exist in v1.2.5 ... they were introduced 27 versions later in v1.3.x series ...

I would recommend upgrade to v1.3.5 ... using the test site and test database approach for this ...

You code is very buggy, has security issues and lacks in hundreds of features that are now built into Zen Cart ...

And do not rush the upgrade ... there is a big difference in v1.3.x series ... take your time and do it right ...

20 Sep 2006, 7:35 PM
#6
mdmerrell avatar

mdmerrell

New Zenner

Join Date:
Nov 2005
Posts:
14
Plugin Contributions:
0

Re: Displaying define_main.page.php only once

Thanks, I'll start the upgrade process NOW!

-Mike M.

17 Oct 2006, 9:49 AM
#7
neunetllc_com avatar

neunetllc_com

Banned

Join Date:
Oct 2006
Location:
New Albany Ohio
Posts:
113
Plugin Contributions:
0

Re: Displaying define_main.page.php only once

how old is zen cart anyway? care to take us down memory lane anyone? maybe i should grab a drink and take this to the pub.

23 Nov 2006, 3:49 PM
#8
qubit avatar

qubit

New Zenner

Join Date:
Mar 2005
Location:
Chesterfield, UK
Posts:
23
Plugin Contributions:
0

Re: Displaying define_main.page.php only once

Hi Linda,

Could you please clarify what I need to do in order to have the flash header run once on entering the site. Basically I have added the following to the tpl_header.php - which workd great:

<!--bof-branding display--> <div id="logoWrapper"> <div id="logo" > <script type="text/javascript" src="includes/templates/handbag/jscript/swfobject.js"></script> <div id="flashcontent"> This text is replaced by the Flash movie. </div> <script type="text/javascript"> var so = new SWFObject("includes/templates/handbag/images/flash/header.swf", "header", "800", "125", "8", "#000000"); so.addParam("loop", "false"); so.write("flashcontent"); </script>

I am currently editing the init_special_funcs.php file as specified in your post but I'm a little puzzled. Do I basically just need to edit the file so it reads:

if (!isset($_SESSION['updateExpirations']) || $_SESSION['updateExpirations'] !== true) {
$_SESSION['run_flash'] = true;

Then do I add the following lines to the tpl_header.php above the flash entry:

if ($_SESSION['run_flash'] == true) {
$_SESSION['run_flash'] = false;
// do flash stuff
}

I've tried the above but it just shows 'if ($_SESSION['run_flash'] == true) { $_SESSION['run_flash'] = false; // do flash stuff }' above the flash header.

Any advice you can give me on this would be greatly appreciated :)

Thanks,
Q