简体   繁体   English

如何使用HMVC为锚的href分配值

[英]How to assign a value into the href of an anchor using HMVC

<a href="{seolink module='listings' method='view' data=$item}">{$item.output_name}</a>

Could anyone kindly explain what exactly happening there. 任何人都可以请友善解释那里到底发生了什么。 I got that it is passing $item to the view method of a listings module and what is that seolink. 我知道它正在将$ item传递给Listings模块的view方法,以及那个seolink。

Kindly help me out. 请帮我。

如果我是你,我本可以尝试

<a href = "<?php echo base_url();?>/module/function_name"></a>

I have same problem! 我有同样的问题! I have a Virtual host and using the laragon instead of Xampp. 我有一个虚拟主机,并使用laragon而不是Xampp。 I am working with HMVC Codeigniter and I have defined the base_url in config.php as: hmvc.test. 我正在使用HMVC Codeigniter,并且已在config.php中将base_url定义为:hmvc.test。 It is working perfectly for functions. 它对于功能来说是完美的。 When I create a php anchor or a href tag it redirect me to 127.0.0.1: 当我创建php锚或href标签时,它将我重定向到127.0.0.1:

<?php echo anchor('tasks/create', '<p>Create New Task</p>'); ?>
OR
<a href="<?php echo base_url('tasks/two_col_template'); ?>">Create New Task</a>
OR
<a href="<?= base_url('tasks/two_col_template'); ?>">Create New Task</a>

But when I remove echo before base_url() it works fine. 但是,当我在base_url()之前删除echo时,它可以正常工作。

<a href="<?php base_url(); ?>/tasks/two_col_template"> create Task</a>

Can anyone tell me the reason why it is redirecting me to 127.0.0.1/Modules/Controller 谁能告诉我将其重定向到127.0.0.1/Modules/Controller的原因

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

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