ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

links

February 03, 2011 12:22pm

Subscribe [3]
  • #1 / Feb 03, 2011 12:22pm

    fin

    168 posts

    Hi, I’m running 2.1.3 Build:  20101220. I just need a little clarification on links. In the user guide, it explains how the path variable {path='article_group/index'} creates links to the templates within the site. What about linking to the index of a template this way:

    <a href="/articles/">articles</a>

    ? I’d prefer my navigation to link using the latter example. Can someone explain how and when to use these different methods of linking? Thanks.

  • #2 / Feb 03, 2011 10:30pm

    Rob Allen

    3114 posts

    <a href="http://{path=article_group/index}">articles</a>
    and
    <a href="/articles/">articles</a>

    both do the same thing, only the first one uses a tiny bit of overhead because EE has to convert the code into a HTML link.

    Hard coding links is fine if a) they won’t change very often, or b) they don’t have to be dynamic, such as using the same link to call different categories.

  • #3 / Feb 04, 2011 7:24am

    fin

    168 posts

    Thanks bluedreamer, can you tell me why one would work, the path variable

    <a href="http://{path=article_group/index}">articles</a>
    , and the other doesn’t work,
    <a href="/articles/">articles</a>

    . I get a 404 error, file not found, when I use the latter.

  • #4 / Feb 05, 2011 12:45pm

    Sue Crocker

    26054 posts

    Hi, fin.

    That’s because your template group is article_group, not articles. Are you removing index.php from your urls via .htaccess?

  • #5 / Feb 05, 2011 5:17pm

    fin

    168 posts

    Hey Sue, I have been working on removing the index.php from the site using the .htaccess file. From the EE wiki, I used this method:

    RewriteEngine on 
    RewriteCond $1 !^(images|system|themes|favicon\.ico|robots\.txt|index\.php) [NC]
    RewriteRule ^(.*)$ /index.php/$1 [L]

    I wasn’t able to remove the index.php file from the url, however. That must mean I’m missing something. I renamed the system folder and in the admin general configuration I named the index.php to the name of the site. Should this line,

    RewriteRule ^(.*)$ /index.php/$1 [L]

    , have the new renamed too where the index.php is? Presently, I’m also have problems with my file manager, so I have a feeling that these problems are related?

  • #6 / Feb 07, 2011 3:07am

    John Henry Donovan

    12339 posts

    fin,

    You will need to test this for us without the htaccess enabled and index.php back in General Configuration. We don’t support the removal of index.php via a htaccess.

    Alternatively I can move this thread to the CodeShare Corner if you wish for the community to help on this one.

    Let us know what you wish to do

  • #7 / Feb 07, 2011 8:44am

    fin

    168 posts

    No, first I want to resolve this problem. I’ve removed the .htaccess file and change the general config file to index.php. Currently, I’m still unable to remove the path variable. Thanks

  • #8 / Feb 07, 2011 7:14pm

    Sue Crocker

    26054 posts

    fin, your problem has to do with what you have named your template group.

    articles

    versus

    article_group

    There’s no way you’ll be able to get this to work the way you want it (keeping index.php out of the equation for now) unless you rename your template group name from article_group to articles.

    Does that help?

  • #9 / Feb 07, 2011 8:09pm

    fin

    168 posts

    Thanks Sue. Sorry, I’m a little confused.  To create a link to articles like this

    <a href="/articles/">articles</a>

    .  I must rename the template group from articles_group to articles? I’ve changed the name from article_group to articles.
    Does this also mean that I will have to remove the index.php from urls, using the wiki page on that topic? As John said, EE doesn’t support the removal of index.php through .htaccess, so I’ll have to go to the CodeShare Corner if I encounter any problems with that?  Thanks again for the help.

  • #10 / Feb 08, 2011 2:41pm

    Sue Crocker

    26054 posts

    I must rename the template group from articles_group to articles? I’ve changed the name from article_group to articles.

    That’s what it means. 😊 Yes, you’d need to add index.php in the link unless you remove it via .htaccess.

    Yes, you can certainly give it a try to get the result you want, but if you run into issues, we’ll move this thread over to CSC. Make sense?

  • #11 / Feb 08, 2011 4:54pm

    fin

    168 posts

    Yes, that makes sense. I’ll work on getting that .htaccess file working and see how it goes. Thanks.

  • #12 / Feb 09, 2011 1:16am

    John Henry Donovan

    12339 posts

    Ok. Will keep this thread open for a while longer for you

  • #13 / Feb 14, 2011 11:08am

    fin

    168 posts

    Thanks, I’ve posted this issue in the CSC, and I’ve made some progress. You can close it if you want.

  • #14 / Feb 14, 2011 3:08pm

    Ingmar

    29245 posts

    Very good. Please don’t hesitate to post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases