I have a codeigniter project that is already up and running perfectly on the client server, now after I changed my laptop and installed xammp 1.8.2 the project is not working correctly,
the index page works just fine, and when I try to log in it only displays these two lines
load->view('header');?>
load->view('side_menu'); ?>
These two lines are the only php code in the view Home.php ,so the problem is that load view function in the controller loads the view "Home.php" but only displays the php code
The hierarchy is:
application
controller
main_controller.php
view
home.php
and attached a screen shot of the displaying
Could any one help me with that???
Thanks in advance
Given your example, You will need to open your php document with <?php and end it with ?> (not on each line as you have it.)
You will also need to use $this from the controller class.
<?php
$this->load->view('header');
$this->load->view('side_menu');
?>
Related
I have a project in laravel5 and I have directed virtual host on /public directory. Where should be my main page index.php now? There is some index.php in public folder already but it contains some content that I dont understand. So where should be my index now? Maybe in views?
If you are using Laravel 5.1 then your initial page should be this resources/views/welcome.blade.php.
You can change it to any name. But also you should change the same in your Controller.
Note : If you are rendering the view through controller then you should have the file name like this yourfilename.blade.php
Your views should always inside resources/views/*
The index file stays at the same place, to call a new file that you made, could be with HTML, you can put that file in the view and call it from the controller, hope this is the answer you are looking for.
When a request come to your server, the first file that it is executed is index.php. But this is not the file shown. In Laravel you don't have to force any file be named index.php. So let's imagine that you are trying set up a new index file. You have to use routes.php
routes.php
Route::get("/" , "HomeController#index");
HomeController.php
function index(){
return view("home/index");
}
views/home/index.blade.php
<html>
<head>
</head>
<body>
<p>Index page</p>
</body>
</html>
When a GET request to "/" it's done, the index function of the HomeController it's executed and the view index.blade.php, stored in views/home it's shown.
This it's the basic behaviour of Laravel. So you mustn't rename or move the index.php file in public folder.
I'm currently working with codeIgniter framework and the problem i'm facing is with template integration with it. In view pages the links aren't working.Like if i've to navigate using
<p>Contact
i changed this with
<li><strong>Contact</strong></li>
And this:
Contact</li>
but nothing happens. May i know how to navigate to other views using these menue tags?? I've also loaded views from controller but the result is same.
Thanks in advance..
What do you mean by saying that nothing happens? do you get any error? does the page even redirect? if the page redirects and you still cannot see any errors put this code in the head of your index.php for debugging purpose: error_reporting(E_ALL); ini_set('display_errors', '1'); and watch the errors you are getting.
There could be a few reasons for it:
you didn't loaded the Helper: $this->load->helper('url');
you should configure the base_url in your config.php: $config['base_url'] = '';
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..
I would like to have the page on user/sidebar on the right in the template design.
Normally, I would include a php file. But I am using Kohana Framework so I have created a view and a controller for this sidebar, and exists on mysite.com/user/sidebar
Now how would i <?php include "/user/sidebar"; ?> correct? I get no such file og dir error for this. I tried full url, but allow_url_include=0
Just looking through the Kohana documentation...
It seems like you can include a "request" inside a view with the following command.
<?php echo Request::factory('user/sidebar')->execute() ?>
See this page for more info: http://kohanaframework.org/3.0/guide/kohana/mvc/views
AndrewR's comment is close. For Kohana 3.2, you'll want to load a view within a view and not a request within a view:
<?php echo View::factory('/user/sidebar'); ?>
or
<?php include Kohana::find_file('views', 'user/sidebar') ?>
Either is acceptable to do.
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/