CodeIgniter 1.7 reCaptcha Help - php

http://codeigniter.com/wiki/ReCAPTCHA/
Okay. So I download the code. Move all the files to the appropriate folders. Set the keys in the config/recaptcha.php file. Then where I have my form submit logic I put in the
$this->form_validation->run()
function.
Then in the HTML I do what?? I need to display the captcha for user input. I see google's code for adding the php recaptcha into non-code igniter documents, but I'm not sure which parts of that are relevant. And I'm not sure how I'm supposed to be making calls to particular files. Right now
<? $this->load->view('recaptcha.php');
$publickey = "thekeynumbersandgibberish";
echo get_html($publickey);
?>
this currently breaks my HTML page, I figure I'm not calling the file and function correctly using code igniter syntax. What is the proper syntax? This was not included in the code igniter documentation.
Insight would be appreciated.

You need to call this in your controller first
//In your Controller
$data['recaptcha'] = this->recaptcha->get_html();
$this->load->view('my_view',$data); //try it with the test page first
//In your View
$this->load->view('recaptcha.php');
The instructions in the wiki are pretty straightforward. Don't load the files in the view. Assign the HTML in the controller.
This is the normal process when working on MVC.
There's a basic CI tutorial here : http://net.tutsplus.com/tutorials/php/codeigniter-basics/

Related

Calling PHP from Smarty template

I am trying to integrate an ad package into my Smarty based site. I have been given the following PHP code that I need to add to my footer file. But due to it being Smarty I need to add the code instead to my php file so that it can be called/included in my Smarty template file. This was the code that I was given and that I need to include:
<?php if(function_exists('ad_footer')) ad_footer(); ?>
But in the php file I am not sure how to achieve this - I have got this example and wanted to know if it looked correct??
if(function_exists('ad_footer')) {
ob_start();
ad_footer();
$smarty->assign('ad_footer', ob_get_clean());
}
Does the above look the right way to do it?
Thanks in advance
I went ahead and created a test page to see if the above worked and it did so will stick with this code.

How to find out which view file is loaded in Joomla 3.2?

I'am templating the website under the Joomla 3.2.0 for HikaShop ecommerce component, and would like to find out which file is loaded with following code, so I could correctly override the styles for specific file.
The filename I'a working with is root\templates\MY_TEMPLATE\html\com_hikashop\user\registration.php. Inside that file there is a small part of code which underloads custom fields I would like to override with custom styles:
<div class="address-fields">
<?php
$this->type = 'address';
echo $this->loadTemplate();
?>
</div>
Anyone knows which filepath is exactly loaded with the following $this->loadTemplate(); ?
Not sure if you are using it the same way as it is used here, but they explain it as if the parameters you pass in the function loadTemplate(), actually as loadTemplate(address) would be files in your case found in registration_address.php
hey, It's worth a shot checking it out
SEE HERE

What could cause something like that ? PHP - MYSQL failure

Firstly i want to explain how my script works..
I'am using script named TSUE and source code protect by ioncube. Script has own plugins system kind of like vbulletin's Addons system. For using this system i need to create new php function to get data from database and i need to create a template for use(show) them as i want.
I created very simple plugin sample code. I'm getting tid and added coloum in tsue_torrents table with this function;
and using by this template i can show this data which page i want!
here is template
(template name is example btw. need to call that template using by eval in function)
<div class="widget">
<h4>Plugins Example</h4>
<br />
{$output}
</div>
Everything is look fine
But when i add this plugins on my main page or anypage of script I getting error like this;
��\IsG�>��%x!��n�(.���d)D�94��]J��]�$A����4a}�.sҍ��z_VU/ #��/��#-�YYY�U�w��|������~�ܦ�Lz���ѷk����SK�z��н� �ч�v)7�q�m"���u�c&O:�$B�����Nm���œ �m6OOO<!І�/rP�V�5��f�� �s%�#;�� �4MT*S_t���=�����n������˷��7��D�Lw���4S�l�w�%#u��� Ⱥ/����p?�S�s�]�?o �c_�=�~*�u4�]��/*�'B-<[�<�T�ϓ�J'S`�>w�*?s���/�1K�ߩ�9j$:_��F<���O:��g~G79��~t���1��8�|��$��b?��H�T����L:)pq�C���P�4����Ӑ�+G|(zC�C�&�8�:�����9je)!����$�1�)�g1��p�B���̐g!-��N���D*' �Q*�o5�NJ<'%Ha��v,#A_$<���φ2��F�z.O�0J$��&.k,����6]�M�'9��&B#��*�4���Yʾ�Q�i� ���A�P��yV�n��ݴ��tJ?�&8�mO�h�3�ד(Jk�h��iVY��8v��Ô��k��Gˌ����B���b�5�"}��g��c>��vU�}���.l�:h��� `k��4KB=Ȃo�K 0QCz##=;���k�& 7m�+�Q4n�"m�I��E��x�>>�zNO���Ta�M䉆�H�}��v9k�Ӫ���a+�+��#��R����=h7-�H�����R�S�3�a���O�zݨʜ�Ԩu�Ғ��ԮL�mI>i��#�n��f��Juj�=_��0<��zyj�U�9�Z�k�y��H��J�0>����'8L�Z?K�(��QF�B7�������E�uB:�$�i����m�hV�F��AHU�փ� �,�!��wjZ�U��6�pH8y��#OOe� c��5C��\�ɼ :�.���Q]$�lm����%��I�=� ���C��Р��#O�89Pk5����M����f�]_�cc
Screenshot :
Okay; I found why i get that weird error.
I think it is because Dreamweaver CS6.. I don't know excatly reason but when i type my code another php editor , function work fine..

Including file in Joomla - what is the difference?

Can anyone tell me what is the difference between including the js script file in the following two ways,
I made this inside system plugin in joomla and included the js file inside "onAfterInitialise" function.
1)
<script type="text/javascript" src="<?php echo JURI::base(); ?>/plugins/system/test/script/script.js"></script>
This works fine and including the js file correctly, But when I logged-in from the backend the font size from userlisting and listing from other extensions gets enlarged.This is not the issue in my js script.
2)
$document->addScript(JURI::root(). "plugins/system/test/script/script.js");
This works fine without any issues.
Can anyone explain what goes behind this.
Using the second method is simply using Joomla coding standards and adds your script in between the <head> tags.
There isn't much difference except for where the script gets imported on the page.
JURI::base() and JURI::root() are both the same. They both define the root folder for your Joomla site. If you are unsure which one to use, I would recommend using method 2, as it's always good to get used to Joomla coding standards.
You can see the source of addScript() :) Basicly, if you use first method, your srcipt will be added in the same place you wrote the code. Second method will add link to a inner table in $document and will be 'rendered' at the
<head></head>
section at the end of page processing.

How do you include PHP files in the view file of a Zend/MVC?

Maybe I dont understand the MVC convention well enough, but I'm trying to include a file to the index.phtml view for the main Index Controller, and it keeps giving me an Application Error. I have no idea what this error is or why its not working. But I'm using a standard include_once(...) in the view.
Is this even allowed?
A view in Zend is still just a php file. If you are getting errors in a view using include_once(), they are probably because the file you want can't be found in your include path. Trying dumping get_include_path() into the view and you will see what directories PHP is searching to find your included file.
As an alternative to include_once, you could use
<? echo $this->render('{module}/{action}.phtml') ?>
to pull in the file.
There are partial views for such purpose
http://framework.zend.com/manual/en/zend.view.helpers.html (ctrl+f Partial Helper)
The view is only the HTML that will be rendered. It's the very last thing that is processed. The controller is called first, then it calls whatever models are needed within. After passing all the data to the view, the view's HTML is rendered.
In short: whatever you include in the view, the controller isn't aware of it. You need to run your PHP includes earlier in the code. If you do it in the controller, it should work OK, I suppose (not tested, so I don't guarantee anything).
You can use Zend View Helpers for this purpose
last time this works fine for me. You can try this:
<?php echo $this->partial('common/left_menu.phtml'); ?>

Categories