Right now there are only two or three functional links on the website. The rest are "dummy" links that are there only to help flesh things out, giving me a better perspective into how the layout will look in the end.
Up until this point, I have created all the links using standard HTML as such:
<a href="site/links">Links</a>
I decided instead to create a function in the PageControl class that will handle all site links. Now, creating a link will look like this:
echo $page->getLink("Links","site/links");
This returns the HTML code seen above. Why go about it this way? Basically, flexibility. If I decide to change the way file paths are displayed in the url, its just a matter of altering the why the function returns the href attribute.
I also created some functionality that will make it easy for visitors to distinguish dummy links from functional links as the website is being developed. As I said before, I like having these for visualization purposes. For example:
echo $page->getLink("Register","");
This prints an empty link. The problem is visitors to the website won't know it's an empty link until they click on it! To make page browsing easier, if the getLink method sees and empty href, it will return the following code:
<a href=""><span style="text-decoration:line-through">
Register</span></a>
As you can see, a span with a line-through style is added, and this is the result:
Register
Now, it's obvious that this is not a clickable link! More functionality could be added to this function as well, such as returning text without the anchor tags if that link is the current page. But for now, I'll quit obsessing and move on!
View the PageControl class here

No comments:
Post a Comment