简体   繁体   English

HTML模板与CodeIgniter的集成

[英]Html template integration with codeIgniter

I'm currently working with codeIgniter framework and the problem i'm facing is with template integration with it. 我目前正在使用codeIgniter框架,而我面临的问题是与模板的集成。 In view pages the links aren't working.Like if i've to navigate using 在视图页面中,链接不起作用。

<p><a href="contact.php">Contact</a>

i changed this with 我用

<li><a href="<?php echo site_url('welcome/contact'); ?>"><strong>Contact</strong></a></li>

And this: 和这个:

<a href="#" onclick="clickCustom('<?php echo site_url('welcome/contact'); ?>');">Contact</a></li>

but nothing happens. 但什么也没发生。 May i know how to navigate to other views using these menue tags?? 我可以知道如何使用这些menue标签导航到其他视图吗? 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'); 如果页面重定向并且您仍然看不到任何错误,请将此代码放在index.php的开头以进行调试: error_reporting(E_ALL); ini_set('display_errors', '1'); error_reporting(E_ALL); ini_set('display_errors', '1'); and watch the errors you are getting. 并观察您得到的错误。

There could be a few reasons for it: 可能有几个原因:

  1. you didn't loaded the Helper: $this->load->helper('url'); 您没有加载帮助程序:$ this-> load-> helper('url');
  2. you should configure the base_url in your config.php: $config['base_url'] = ''; 您应该在config.php中配置base_url:$ config ['base_url'] ='';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM