having an issue with javascript and php ??

Soldato
Joined
6 Jan 2006
Posts
4,663
Location
Newcastle
Hi Im trying to put the cloudflare logo on the footer of my wordpress blog but im failing miserably can anyone shed some light on it ?

Code:
<?php
/**
 * The template for displaying the footer.
 *
 * Contains the closing of the id=main div and all content
 * after.  Calls sidebar-footer.php for bottom widgets.
 *
 * @package WordPress
 * @subpackage Twenty_Ten
 * @since Twenty Ten 1.0
 */
?>
	</div><!-- #main -->

	<div id="footer" role="contentinfo">
		<div id="colophon">

<?php
	/* A sidebar in the footer? Yep. You can can customize
	 * your footer with four columns of widgets.
	 */
	get_sidebar( 'footer' );
?>

			<div id="site-info">
				
echo"<script type='text/javascript' src='http://ajax.cloudflare.com/cdn-cgi/scripts/cf_status.js'></script>\n";
echo"<a href='http://www.cloudflare.com' style='display:block;position:relative;width:0px;height:0px;'>;
<img src='http://ajax.cloudflare.com/cdn-cgi/images/seal/standard/0x0.png' style='position:absolute;clip:rect(0px,0px,0px,0px);border:0;' onload='try{window.__CF.checkStatus(this)}catch(e){}' /></a>";


			</div><!-- #site-info -->

			<div id="site-generator">
				<?php do_action( 'twentyten_credits' ); ?>
				<a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentyten' ) ); ?>" title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'twentyten' ); ?>" rel="generator"><?php printf( __( 'Proudly powered by %s.', 'twentyten' ), 'WordPress' ); ?></a>
			</div><!-- #site-generator -->

		</div><!-- #colophon -->
	</div><!-- #footer -->

</div><!-- #wrapper -->

<?php
	/* Always have wp_footer() just before the closing </body>
	 * tag of your theme, or you will break many plugins, which
	 * generally use this hook to reference JavaScript files.
	 */

	wp_footer();
?>
</body>
</html>
 
You don't need to echo it because you're not inside php tags.

Change:

Code:
echo"<script type='text/javascript' src='http://ajax.cloudflare.com/cdn-cgi/scripts/cf_status.js'></script>\n"; 
echo"<a href='http://www.cloudflare.com' style='display:block;position:relative;width:0px;height:0px;'>; 
<img src='http://ajax.cloudflare.com/cdn-cgi/images/seal/standard/0x0.png' style='position:absolute;clip:rect(0px,0px,0px,0px);border:0;' onload='try{window.__CF.checkStatus(this)}catch(e){}' /></a>";
to:

Code:
<script type='text/javascript' src='http://ajax.cloudflare.com/cdn-cgi/scripts/cf_status.js'></script>
<a href='http://www.cloudflare.com' style='display:block;position:relative;width:0px;height:0px;'>
<img src='http://ajax.cloudflare.com/cdn-cgi/images/seal/standard/0x0.png' style='position:absolute;clip:rect(0px,0px,0px,0px);border:0;' onload='try{window.__CF.checkStatus(this)}catch(e){}' /></a>
 
Hi,

I actually work for CloudFlare. Did you figure this out yet? One thing I did notice a problem with in the actual CloudFlare script is that you're missing the px values (silly bug on our end). If you login to your CloudFlare account & then go to the 'Web Badges' link, you'll end up getting the right code.
 
You don't need to echo it because you're not inside php tags.

Change:

Code:
echo"<script type='text/javascript' src='http://ajax.cloudflare.com/cdn-cgi/scripts/cf_status.js'></script>\n"; 
echo"<a href='http://www.cloudflare.com' style='display:block;position:relative;width:0px;height:0px;'>; 
<img src='http://ajax.cloudflare.com/cdn-cgi/images/seal/standard/0x0.png' style='position:absolute;clip:rect(0px,0px,0px,0px);border:0;' onload='try{window.__CF.checkStatus(this)}catch(e){}' /></a>";
to:

Code:
<script type='text/javascript' src='http://ajax.cloudflare.com/cdn-cgi/scripts/cf_status.js'></script>
<a href='http://www.cloudflare.com' style='display:block;position:relative;width:0px;height:0px;'>
<img src='http://ajax.cloudflare.com/cdn-cgi/images/seal/standard/0x0.png' style='position:absolute;clip:rect(0px,0px,0px,0px);border:0;' onload='try{window.__CF.checkStatus(this)}catch(e){}' /></a>


Hi that's stopped the random code "echo" appearing however nothing is appearing

Hi,

I actually work for CloudFlare. Did you figure this out yet? One thing I did notice a problem with in the actual CloudFlare script is that you're missing the px values (silly bug on our end). If you login to your CloudFlare account & then go to the 'Web Badges' link, you'll end up getting the right code.

tried that and it still dosent work

Code:
<script type='text/javascript' src='http://ajax.cloudflare.com/cdn-cgi/scripts/cf_status.js'></script><a href='http://www.cloudflare.com' style='display:block;position:relative;width:0px;height:0px;'><img src='http://ajax.cloudflare.com/cdn-cgi/images/seal/standard/0x0.png' style='position:absolute;clip:rect(0px,0px,0px,0px);border:0;' onload='try{window.__CF.checkStatus(this)}catch(e){}' /></a>
 
This details the fix

http://support.cloudflare.com/kb/tr...re-web-badge-showing-when-i-put-it-on-my-site

Code:
<script type='text/javascript' src='http://ajax.cloudflare.com/cdn-cgi/scripts/cf_status.js'></script><a href='http://www.cloudflare.com' style='display:block;position:relative;width:180px;height:32px;'><img src='http://ajax.cloudflare.com/cdn-cgi/images/seal/standard/180x32.png' style='position:absolute;clip:rect(0px,180px,32px,0px);border:0;' onload='try{window.__CF.checkStatus(this)}catch(e){}' /></a>
 
Back
Top Bottom