Hi all,
I'm trying to find a command that will echo a string IF the filename starts with an underscore. Effectively, I'm looking for a wildcard symbol.
I'm imagining something like the following:
(the 'class' commands are accessing CSS)
<?php
$big_warp_graph ic = "<td class=\"warp-big\">";
$warp_graphic = "<td class=\"warp\"> ";
$no_warp_graphi c = "<td">";
if ($page == "blah blah - News"
or $page == "blah blah - Glossary")
{echo $warp_graphic;}
elseif ($filename == "_*")
{echo $big_warp_graph ic;}
else
{echo $no_warp_graphi c;}
?>
I'm sure the "filename" command and the asterisk are wrong, but please could someone tell me what they should be.
For clarity, this is what I'm trying to do, and why:
I have 50-odd php pages that contain individual definitions from a glossary.
I originally placed them all in a "glossary/..." folder, but decided against it as the php inserts and images I was trying to access from the glossary entries were not being found after the directory was changed. It would also be a lot of work to adjust all the relevant paths.
My idea is to rename each glossary entry page with an underscore at the start (a random choice, but something that would distinguish them all as being glossary entries, avoiding confusion with the other files). I will then keep them in the main folder. I was hoping that some sort of wildcard function might exist.
As you will have gathered from the code above, my reaon for doing this in the first place is that I want a different graphic on all glossary entries, but also want the freedom to change my mind later with having to open up hundreds of files to edit.
Given my ramble, could anyone suggest eiher a solution to what I had in mind, or - even better - the 'right' way of going about this?
Thanks a lot,
fructose
I'm trying to find a command that will echo a string IF the filename starts with an underscore. Effectively, I'm looking for a wildcard symbol.
I'm imagining something like the following:
(the 'class' commands are accessing CSS)
<?php
$big_warp_graph ic = "<td class=\"warp-big\">";
$warp_graphic = "<td class=\"warp\"> ";
$no_warp_graphi c = "<td">";
if ($page == "blah blah - News"
or $page == "blah blah - Glossary")
{echo $warp_graphic;}
elseif ($filename == "_*")
{echo $big_warp_graph ic;}
else
{echo $no_warp_graphi c;}
?>
I'm sure the "filename" command and the asterisk are wrong, but please could someone tell me what they should be.
For clarity, this is what I'm trying to do, and why:
I have 50-odd php pages that contain individual definitions from a glossary.
I originally placed them all in a "glossary/..." folder, but decided against it as the php inserts and images I was trying to access from the glossary entries were not being found after the directory was changed. It would also be a lot of work to adjust all the relevant paths.
My idea is to rename each glossary entry page with an underscore at the start (a random choice, but something that would distinguish them all as being glossary entries, avoiding confusion with the other files). I will then keep them in the main folder. I was hoping that some sort of wildcard function might exist.
As you will have gathered from the code above, my reaon for doing this in the first place is that I want a different graphic on all glossary entries, but also want the freedom to change my mind later with having to open up hundreds of files to edit.
Given my ramble, could anyone suggest eiher a solution to what I had in mind, or - even better - the 'right' way of going about this?
Thanks a lot,
fructose
Comment