Fog Creek Software
Discussion Board

Knowledge Base
Terry's Tips
Darren's Tips

Link bug when using .php extension

I've searched the forum about this bug, but didn't find anything.

I've got one single template in my site that generates .php files. Then i've got a foreach-loop that generates the left-hand menu on my site. When i within that loop use to get the address of that article i get Foldername/index.html although the file's name actually is Foldername/index.php.

Anyone's got an idea about what I should do?

Regards, Henrik Jernevad

Henrik Jernevad
Friday, March 14, 2003

When the file in question is published, is it published as index.html or index.php?

David Burch
Friday, March 14, 2003

Double check that the extension for your template is really .php (in the Templates window, choose the template and click Properties). I've tried the same thing you're describing here, and it works fine.

Joel Spolsky
Friday, March 14, 2003

The template's extension is .php, I have no other template and all relevant files are using that template. All files are published as .php but the links are still .html. =(

As a temporary solution, i used .extra1 and wrote the url of the article there and used .extra1 instead of .link in the script. But that's an ugly solution.

I also publish the menu script, in case that helps:

{$foreach x in (and (filename "index") (not (keyword_contains "(nolist)")))$}
      <h4><A href="{$$}" title="{$x.teaser$}">{$x.headline$}</a></h4>

This code is written in the template and all files the loop should find are normal articles called index (using the php template) and is placed in different subdirectories. Everything works fine, except for the extension.

Any more tips is highly appreciated.

Henrik Jernevad
Saturday, March 15, 2003

That's really strange. Can you email your .CTY file to me at and I'll look at it?

Joel Spolsky
Saturday, March 15, 2003

*  Recent Topics

*  Fog Creek Home