Recent Topics

1 Jan 17, 2009 18:08    

I'm the author of the reCAPTCHA plugin, which is now hosted at epapyr.us. I'm working on updating it (they've come out with some new skins and the ability to provide your own). You can learn more about the project at www.recaptcha.net

The captcha image is called using javascript:

<script type="text/javascript" src="http://api.recaptcha.net/challenge?k=PUBLIC_KEY"></script>

For those that have javascript disabled, there is also a "noscript" option. Currently, the image returned is left-justified. I would like to center it on the blog for a more integrated appearance.

I've tried wrapping the output of the recaptcha_gen() method in <center></center> tags, even though <center> is deprecated, but that didn't work.

I tried using <div align="center"></div>, but that's supposed to just align everything inside the div, not the div itself. That didn't work either.

Is there a b2evo or plugin API that I can use to center the image I get back from reCAPTCHA?

Thanks in advance.

2 Jan 17, 2009 19:39

No there is no B2evo trick. This is simple XHTML.

<div class="recaptcha">your code goes here</div>


and some stylesheet:

.recapthcha {
    margin-left: auto;
    margin-right: auto;
}


The <center> tag is deprecated and replaced by

text-align: center;


however that will only center inline elements. An image is a block element.

In your situation it's easiest to use some existing class that already centers images. That saves you adding the extra css/stylesheet.

Good luck

3 Jan 17, 2009 19:56

as a follow-up, can I provide and access that stylesheet from within the plug-in, or do I have to instruct users to modify their skin's stylesheets?

4 Jan 18, 2009 07:57

Usually a plugin ( that requires styles ) ships with it's own stylesheet and adds it to a skin like this :

	/**
	 * Spits out the styles used
	 *
	 * @see Plugin::SkinBeginHtmlHead()
	 */
	function SkinBeginHtmlHead()
	{
		require_css( $this->get_plugin_url().'style.css', true );
	}

¥

5 Jan 18, 2009 23:57

Ok, I'm still not getting it!

I read the docs for [url=http://doc.b2evolution.net/HEAD/evocore/_blogs---inc---_core---_template.funcs.php.html#functionrequire_css]require_css()[/url] and the code within [url=http://doc.b2evolution.net/HEAD/__filesource/fsource_evocore__blogsinc_core_template.funcs.php.html#a520]_template.funcs.php[/url] and this is supposed to output a stylesheet link, ie.

<link rel="stylesheet" href="templates/subSilver/subSilver.css" type="text/css"/>

I added the function Yabba provided above, but when I saved the file, refreshed the page and viewed the page source, I didn't see my stylesheet link (recaptcha.css).

I looked at the creativecommons_plugin code, because that stylesheet is printed in the source of the page, and the author of that plugin manually provided the stylesheet link:


function SkinBeginHtmlHead() {
        echo "\n".'<link rel="stylesheet" type="text/css" href="'.$this->get_plugin_url().'cclicense.css" />'."\n";
        }

I tried this method, but did not get the same results. How can I debug this process to determine why my code is apparently not being executed?

Thanks.

6 Jan 19, 2009 00:09

A quick follow-up:

Out of desperation, I went into the backoffice, disabled my plugin and then re-enabled it. After this, I refreshed the page and the stylesheet link was there!

Hopefully this bit of knowledge will save someone some frustration and time in the future!

7 Jan 19, 2009 09:15

Sorry, I forgot to say that when you add new hooks to a plugin you need to goto admin > global settings > plugin install and click "reload plugins"

The require_css() method is the most future proof ;)

¥


Form is loading...