1

我在标题中创建了一个自定义菜单,我在其中放置了About UsRegister的链接Contact Us

现在我想利用 SEO URL。我在管理员中设置了 SEO URL 关键字,所有页面都可以正常工作,但自定义链接不起作用。

这是我添加到标题中的自定义代码

<div class="nav">
      <ul>

        <li><?php foreach ($categories as $category) { ?><a href="<?php echo $category['href']; ?>"> <?php }?> Products</a></li>
        <li><a href="index.php?route=account/register">Register Now</a></li>
        <li><a href="index.php?route=information/information&information_id=4">About Us</a></li>
        <li><a href="index.php?route=information/information&information_id=7">The Company</a></li>
        <li><a href="index.php?route=information/information&information_id=8">iPhone App</a></li>
        <li><a href="index.php?route=information/contact">Connect@Cobra Razors</a></li>

        </ul>
    </div>
4

1 回答 1

1

OpenCart uses a URL class to handle all of your links. It has the format

$this->url->link('route_here', 'parameters_here', 'SSL/NONSSL');

Only the first parameter (route) is required however. For example, the Register Now link you have above would be

<a href="<?php echo $this->url->link('account/register'); ?>">Register Now</a>

However it should be a secure page since a customer is expected to input sensitive data, so you need to link using an HTTPS link (will automatically set to HTTP if your store doesn't support SSL) so we need to set the third parameter to SSL. If we don't, by default it's set to NONSSL

<a href="<?php echo $this->url->link('account/register', '', 'SSL'); ?>">Register Now</a>

As you'll notice, the second parameter is just an empty string. This is because it doesn't have any extra parameters. This brings us onto your info pages links which will need the information_id parameter

<a href="<?php echo $this->url->link('information/information', 'information_id=4'); ?>">About Us</a>"
于 2013-10-28T10:01:50.297 回答