Pause music when switching to another page in php [closed] - php

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I like to pause music when switching to another page from home page & on returning back we should resume the music as it was before. It shouldn't need to restart the music again when I get back to home page.
We are using flashplayer found from this site:
http://flashnifties.com/products/nifty-audio-player/documentation/
However we have not found any script which fulfill our need.
Please help me if anyone has the solution of this problem.

The critical part of this problem is that you are reloading the page, which completely resets the Flash player within it. You are left with two options:
Implement your site as a single page application and use ajax to refresh the content. This means that the Flash player will not be reloaded when the user needs more content (this is what we do on our site).
-or-
Use a frameset, with player loaded in one frame, and rest of website in the other. This is a bad choice of architecture... frames are evil.

It looks like you can pause with this:
audioPlayer.pauseAudio()
I would add this javascript to the button or object that changes to a new url (page). This listens for an action and does
document.getElementById('newPageButton').onclick = function() {
//interact with the flash "audioPlayer.pauseAudio();", cache song time location.
//go to next page code
}
you'll probably need to write your own actionscript to save the location of were the song was paused at. Looking at the documentation there isn't a way to see exactly were the song was paused.
After you figure that out, store the location on some sort of caching. Load that caching when you go back to the page. Though looking at the documentation again, it looks like you'll need to write some actionscript to get resuming at a specific time working.
This might not be the best flash player for what you wish to achieve.

Related

Pass URL parameter (utm code) across my site's webpages [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have a webpage I'm trying to promote via ad banners. I want to associate a utm code to those those links, so when a visitor lands on my website, I'll be able to track where they came from (mysite.com?utm_campaign=adXYZ)
Normally these ad banners lead to a single webpage with single point of conversion where I'm able to capture the utm_campaign ID and gauge how effective my marketing is. However, I'm now leading users to a full website with many pages and many points of conversion. I'm hoping to keep that utm_campaign ID across multiple pages using some crafty JS or PHP.
For example:
user clicks ad banner to mysite.com?utm_campaign=adXYZ
user lands on mysite.com but wants to go to mysite.com/features
user goes from mysite.com/features to mysite.com/pricing
By the time the user reaches mysite.com/pricing, I want ?utm_campaign=adXYZ to still be there in the URL.
I know there are ways via analytics and what not to track a session/conversion, but I specifically need to capture the referral utm code in an HTML form down the road. Can anyone point me in the right direction? Thanks a bunch!
Edit: An important point to note. The site should still be accessible organically via search, bookmark, linking, etc and not have the trailing campaign ID in the URL. Only when user visits the site from ad banner should the campaign be there and all subsequent pages.
I would set a cookie containing the relevenat information the first time the user enters your website.
Otherwise you have to pass the information every time again with every request (GET / POST). This solution will work even if the user don't allow cookies. Murat Cem YALIN wrote how this works in detail. But if you want to use the JS-method: Be aware that the user must have JS activated!
The third option might be using PHP Sessions.
you can do it with both php and js.
in php use simplehtmldom (http://simplehtmldom.sourceforge.net/) to access all links in html output and add ?utm_campaign=adXYZ to all of them just before outputting rendered html.
in js you use jquery to do the same when the document loaded. ex:
$("a").each(function(){
$(this).attr("href", $(this).attr("href") + '?utm_source=adxYZ');
});

bulk "fetch as google" by PHP [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I update my website content daily, around 15 to 20 new pages.
From my webmaster account, I "Fetch as Google" for each page, long process..
Is there a way to automate it by PHP?
Can PHP "auto submit" my new pages for me (The New Links are in a MySql data) to "fetch as google"?
Please help.
Thank you.
It is wrong to do that "by hand".
I will cite another answer
I would say it is not a preferred way to alert Google when you have a
new page and it is pretty limited. What is better, and frankly more
effective is to do things like:
add the page to your XML sitemap (make sure sitemap is submitted to Google)
add the page to your RSS feeds (make sure your RSS is submitted to Google)
add a link to the page on your home page or other "important" page on your site
tweet about your new page
status update in FB about your new page
Google Plus your new page
Feature your new page in your email newsletter
Obviously, depending on the page you may not be able to do all of
these, but normally, Google will pick up new pages in your sitemap. I
find that G hits my sitemaps almost daily (your mileage may vary).
I only use fetch if I am trying to diagnose a problem on a specific
page and even then, I may just fetch but not submit. I have only
submitted when there was some major issue with a page that I could not
wait for Google to update as a part of its regular crawl of my site.
As an example, we had a release go out with a new section and that
section was blocked by our robots.txt. I went ahead and submitted the
robots.txt to encourage Google to update the page sooner so that our
new section would be :"live" to Google sooner as G does not hit our
robots.txt as often. Otherwise for 99.5% of my other pages on sites,
the options above work well.
The other thing is that you get very few fetches a month, so you are
still very limited in what you can do. Your sitemaps can include
thousands of pages each. Google fetch is limited, so another reason I
reserve it for my time sensitive emergencies.

In page A/B testing [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I looked all over google and the internet as to performing In Page A/B testing.
What I am trying to do is perform A/B testing on a single page, but that page's content varies on the referring url, performed through <?php include
Say if you come from Google, it displays, 'Hey, are you new here?!', or if you come from another page on our website it will display 'Let's get you started'. The goal is then to see which page has longer visit duration.
Does anyone know of how to do this through Google analytics/Optimizely or any other analytics plugin?
Ryan,
I believe this shouldn't be too difficult to do... just depends on the tools you use :-).
Personally, I can recommend Visual Website Optimizer, which allows you to segment a running test to specific segment based on various conditions. Referring URL is one of them (see screen below).
However, you can then use only one variation of the page, so if you have more segments that you would like to test, you would need to:
Duplicate the test itself,
Change the copy in the variation,
Set up the segment rules according to your needs,
Follow this procedure with every segment :)
I have done this, but can't say it had much impact. It was too much work and I personally prefer segmenting based on customer data (new/existing customer etc.), where you can notice much more impact and it's also then "easier" to report since the differences are quite noticeable.
Hope this helps!
You should be able to set this up in any modern A/B testing tool on the market. Here’s how to do it in Optimizely:
Create a new experiment and go to Options and Targeting. Select the page that the experiment should run on and select the referrers it should run for in Visitor Conditions:
Make sure that the messaging isn’t displayed for the the Original / Control / A in the experiment.
For the Variation / A, use the visual editor to add an element with the messaging or select an existing element on the page to change it’s text. You can also write Javascript code to insert the element (via ‘Edit Code’).
If you want to display different messages for different referrers, click on the the ‘Edit Code’ ribbon in Optimizely and wrap the Javascript in if clauses for each referrer (and create a backup message), like so:
if (document.referrer.match(/^https?:\/\/([^\/]+\.)?reddit\.com(\/|$)/i)) {
$('#welcome-message').text('Hi redditor!');
} if (document.referrer.match(/^https?:\/\/([^\/]+\.)?huffingtonpost\.com(\/|$)/i)) {
$('#welcome-message').text('Hi Huffington Post reader!');
} else {
$('#welcome-message').text('Hi! I’m a backup message, just in case !');
}
Select Options and Analytics Integration. Enable Google Analytics.
Start the experiment. Within a few minutes you should see the first results in Optimizely. In a few hours, results will be available in Google Analytics, where you can drill down to see how things like visit duriation, pageview per visit and bounce rate changed based on custom segments (that’s how the variations are displayed in Google Analytics).

how can I change the content when browsing a web page? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I want to write a program to change the content when browsing a web page, and suppose to add the following feature:
1) to highlight some keywords
2) change the background of the keywords
3) when mouse move on it, will give a message bubble
I have some ideas, but I am not sure which one will work:
write an addon for firefox
write an extension for chrome
write a proxy using php to change the content of the web page being proxy-ed.
inject javascript to the web page
other solutions ... ?
which one can solve the problem ? and which one is the best?
Thanks in advance.
Try using a bookmarklet. They are simply javascript snippets masquerading as bookmarks in a user's bookmark bar. When a user clicks on the bookmark, the javascript code is injected and run on the current website. You wouldn't need to have your users download additional software or be tied down to a particular browser.
Here is an excellent link to get you started
http://net.tutsplus.com/tutorials/javascript-ajax/create-bookmarklets-the-right-way/
It is 1+4 or 2+4 (or 1+2+4), you'll have to write a script that will be injected to the pages and it can be used as a Firefox Greasemonkey script or a Chorme extension.
Unlike in Firefox where you need Greasemonkey to make scripts work, a simple script file can be used directly as a Chrome extension by dragging it to the extensions window. With some more official documentation on how to organise an extension you can make it a complete Chrome extension.
A sample script that will inject script only when you are on stackoverflow:
script.user.js
if(document.URL.indexOf("http://stackoverflow.com")!=-1) {
var d = document.createElement("div");
d.innerHTML = "Hello World! This is my first injected script";
d.className = "red"; // supposing it's defined, wouldn't hurt anyways
// otherwise
d.style.color = "#f00";
document.body.appendChild(d);
}
Save your file and drag it to the "extentions" window on Chrome, then reload stackoverflow.

Working options without API's in PHP [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
There is a site that does not have a standalone search or API product available at this time, and I need a PHP page which can get information another way. This site has a manual search function to pull data, is there a way for my page to go to the site, click on the search parameters that I need and pull the results into my page? Maybe there's a better way?
Example.
realestate.com.au, I want a user to enter the same search fields in my php file, go to realestate.com.au, plug in those search parameters in that site, then as the results of my search come through, eg, 3 bedrooms, 2 bathrooms in the Suburb of Marylands, I get the price of all the results and in my page calculate the median price, and that field gets outputted to the user on my screen.
Now I have no code for this as I don't even know how to start. I cant do most of it if I can find out a way to start by having php go to realestate.com.au (not redirecting the user there, just hooking into the website) and doing the search.
I hope I make sense.
Regards
This is somewhat complex... more than I can cover here. but here is the general steps involved:
1) Build your URL
From your target site, find out what the URL looks like on the search results page. That should tell you how to build your URL for later on.
2) Use CURL to retrieve your custom results page
Using the format that you saw above, sned a request for that page using CURL. Only you will be substituting your visitors search terms into the URL.
3) Scrape the resulting page
CURL will fetch the HTML from the search results page. You will then have to iterate through that result and pull out the needed data using DIV IDs and classes.
4) Serve the final results to your visitor
Drop the scraped data into your own page and send to the browser.
See aslo:
http://voices.yahoo.com/how-scrape-web-page-using-php-curl-5442987.html
NOTE: I would make sure you have permission to scrape the site.

Categories