Calling javascript functions w/in page

Status
Not open for further replies.

radio

Unconsciously competent.
Nov 18, 2007
1,536
48
0
auction2post.com
Trying to work with this Wordpress plugin - PageEar PagePeel - what I would like to do is set it so that it auto opens on a visitors first visit per day and then closes. I thought it would be something like this (not worrying about first visit - more concerned about it opening the peel):

Code:
<?php if (is_home()) {
?>
<script type="text/javascript">openPeel();</script>
<?php } ?>
The plugin puts the script tags in the head for the .js files.

But it's not opening the peel - perhaps I'm doing this totally wrong. Help out a n00b if you're willing and able. Thanks! Meanwhile, I'll be researching cookies and tracking visits.

Using it on my site for the No More Excuses Pt. 2.
 


Exactly. There's a setting in the plugin for an auto open after x seconds, auto close after x seconds but neither work. Also, that would happen each time a page is loaded (annoying!). I just want it to auto open on a visitors first visit during the day. So right now I'm just trying to get it to auto open with no luck (either with the plugin admin panel or putting what I assume to be the right function in the index file.
 
You shouldn't call openPeel() until the page has fully loaded.

Create a separate javascript file, in that file you can check for a cookie (use google to find javascript cookie handling functions), if there's no cookie call the openPeel() function and set a cookie.

Then include the code just before the closing </body> tag like

Code:
<script src="js/openpeelcode.js" type="text/javascript"></script>
</body>
</html>
 
Thanks, Gumby. I think it's a bug in the Wordpress plugin. There's another .zip that's for including on any page and I've added the code there, modified the settings in the .js file - and it works fine. I'm going to run with this. Now time to google cookie handling.

Page peel currently being annoying at Rule One Blog. Hopefully fixed soon w/ cookies.
 
I ended up using sessions instead of cookies because I was having issues with IE7 and cookies - I probably could have set a variable in the cookie vs. expiring it (IE7 does not like short lived cookies) but whatever. Also, decided against using it only if on the home page - fuck it, if the end user has a page bookmarked and they go to it direct - fffppt, they're seeing the page peel.

The script above has an issue - the Wordpress plugin doesn't allow for onLoadOpen value other than false and the script for adding it to a regular site doesn't allow for 'false' only numbers. That bit of faultiness delayed me for some time. Ended up using both .js files - probably have a ton of overkill and stuff being set multiple times, but fuck it - it works how I want it to now. Pretty it up later. See it here for now, here later.
 
Hate to be a complete asshole, but shouldn't you just add content to your site and fuck all the stupid effects off.

I mean, it's not going to make your site any stickier or help the SEO and it's just distracting you from actually building the main site right ?

Build the site out with only what's necessary and add the effects later when your at that stage.

This is definitely cart before the horse.
 
Hate to be a complete asshole, but shouldn't you just add content to your site and fuck all the stupid effects off.

I mean, it's not going to make your site any stickier or help the SEO and it's just distracting you from actually building the main site right ?

Build the site out with only what's necessary and add the effects later when your at that stage.

This is definitely cart before the horse.

No offense taken, mate. I appreciate that and for the most part agree with you - no need to get cute before you have the meat of your site up. But this project is doubling for my 9-5 where we're selling the spot for $750 - $3000 / week depending on the buy - but no buys until it functioned as it does now. Additionally, it's a sweet little thing to have up while I build out the site! HA!
 
Status
Not open for further replies.