• 0

Website theme/skinning tutorial


Question

I've written a tutorial for neowinians on how to create a theme-supported website in PHP:

? This guide will teach you how to quickly develop a theme supported website.

? This guide will teach you how to quickly create hundreds of themes within minutes.

? Itnot t teach you how to make a complex template based website such as drupal.

You need:

? PHP with Apache

? Adobe Photoshop

? Text editor, I prefer InType (freeware,for now anyway)

The idea is that there will a file called ?gui.php? which will contain two functions:

Makeheader($title) //This function will create the top part of the web page, and adding a title

Makefooter () //This will create the bottom part of the web page

image001dr6.gif

Then include the gui.php in any php file you would like to ?theme? e.g.

? Index.php file content:

<?
include( 'gui.php' );
makeheader("Home");

echo "Welcome";

makefooter();

?>

Pretty simple isn?t it?

Now let?s create the basic elements of the header and footer.

image002pg3.th.png

Start new photoshop file, as shown.

image004uc1.th.png

Select the rounded rectangle tool

image006tj0.th.png

Select a style

image008ws0.th.png

Draw the header

image010vf5.th.png

Draw the footer

image012jn8.th.png

You now have a header and footer, try aligning them and make sure they have the same width for consistency.

image014ro7.th.png

Select the slice tool

image016sf0.th.png

Slice the left corner and a small part of the center (the center part will repeat itself in the browser)

image018vv3.th.png

Slice the right corner

image020bc3.th.png

Do the same for the footer part.

image022fl7.th.png

We will now export the 6 images into a folder called images, inside the theme folder (fresh_orange)

image024iv9.th.png

Rename the images for simplicity

Now back to gui.php, the file simply contains two functions, one to make a header and another to make the footer:

<?php


function makeheader ($title)
{
$theme_name = "fresh_orange";  //name of default theme

print <<<end
	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">t;html xmlns="http://www.w3.org/1999/xhtml">lt;head>

	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

	<title>Example.com / $title</title>

	<link rel="stylesheet" type="text/css" href="themes/$theme_name/style.css" />

	</head>

	<body>
<div align="center">
<table cellpadding="0" cellspacing="0" style="width: 850px; height: 90px">
	<tr>
		<td valign="top" style="width: 19px; background-image: url('themes/$theme_name/images/1.gif')">
		 </td>
		<td valign="middle" style="width: 814px; background-image: url('themes/$theme_name/images/2.gif')">
		My Logo</td>
		<td valign="top" style="height: 90px; width: 17px; background-image: url('themes/$theme_name/images/3.gif')">
		 </td>
	</tr>
</table>
</div>
end;
}





function makefooter ()
{
$theme_name = "fresh_orange";  //name of default theme
	print <<<end
<div align="center">
<table cellpadding="0" cellspacing="0" style="width: 850px; height: 32px">
	<tr>
		<td valign="top" style="width: 13px; background-image: url('themes/$theme_name/images/4.gif')">
		 </td>
		<td valign="middle" style="width: 814px; background-image: url('themes/$theme_name/images/5.gif')">
		My Copyright Message</td>
		<td valign="top" style="height: 32px; width: 12px; background-image: url('themes/$theme_name/images/6.gif')">
		 </td>
	</tr>
</table>
</div>
	<br />
	</body>
	</html>

end;
}




?>

Now to make any file themed, simply include gui.php and call the two functions e.g.:

Our index.php file will look like:

<?
include( 'gui.php' );
makeheader("Home");

print <<<end
<br /><br /><br />
<div align="center">Welcome to my website</div>
<br /><br /><br />
end;

makefooter();

?>

Your website will look like this:

image032yd5.th.png

Now lets see how easy it is to create more themes:

Back to photoshop:

image026gu2.th.png

Highlight the header and footer layers, and simply choose a style from your list.

image028qc2.th.png

Another great looking style

image030la2.th.png

And more, easy to make as few clicks.

After selecting a style, simply do the process again, make a new folder and add the images in the correct path..etc

Tutorial php and photoshop files

Things you can do:

  • allow the user to choose and save their favourite theme
  • add your own CSS Files along with themes

Web 2.0 styles, free,huge and great collection.

http://www.dezinerfolio.com/2007/05/06/ult...0-layer-styles/

Edited by Linkin_cs
Link to comment
https://www.neowin.net/forum/topic/605621-website-themeskinning-tutorial/
Share on other sites

2 answers to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • That is a great option for compatibility, but in my opinion, that isn't the future. Xorg/Xserver is outdated with massive security holes built into the core design and cannot be easily fixed. The reason Wayland exists is because it was apparent that no one had the resources/will to revamp Xorg, so it was basically put into a support only mode until it was eventually abandoned. Yes, X11Libre has taken up the mantal, but I don't expect to see anything from them other than basic support.
    • I agree with your frustrations, but after nearly a decade of Wayland ideologs debating how software they don't write should work...its time to rip the band aid of X11 off and let Wayland sink or swim on its own. Its not like Linux can just fail at this point, so devs will flock together to find solutions. It is my opinion that a lot of these silly debates about things like window decorations take place because they can. People feel like they have time to have these academic conversations to "get it right." However, the conversation will change very quickly when the issue is "###### don't work." People will quickly find fixes once we are forced into that mode. I draw a parallel to the infancy of the internet going public in the late 1980s. It became quickly apparent that IPv4 really wasn't up to the task. The ivory tower response to the issues was basically "your doing it wrong, you shouldn't want that" while debating long-off solutions like IPv6. Then some rando cames along and invited NAT, the standards people saw it as an abomination and absolutely refused to include it. He didn't care, sold the product anyway under the name PIX, which he later sold to Cisco. It was not only a massive success, but it changed the entire concept of the internet, basically inventing the idea of public and privet addresses, which totally reformed the way the internet works. The standards guys were forced to adopt it once they realized it was impossible to put the cat back in the bag.
    • Download How to Engage Buyers and Drive Growth in the Age of AI (worth $22.95) for free by Steven Parker Claim your complimentary eBook worth $22.95 for free, before the offer ends on July 1. Develop stronger, more profitable relationships with your buyers in the digital era. Right now, how we buy and sell is evolving dramatically. People have fundamentally changed the way they do business. To put it simply: buyers no longer interact with sellers in the same way. To ensure a profitable future, sales leaders and teams need to embrace this transformation. In the face of globalisation, ecommerce, subscription services, and new digital tools for buyers and sellers alike, you need new strategies to generate successful sales and better bottom lines. Deep Selling shares the cutting-edge sales model you need to create a buyer-obsessed, high-performance culture. Your team urgently needs to embrace the growing suite of digital and AI technologies. But new technologies alone won’t solve all your selling problems. To really maximise your success, you need to evolve your selling frameworks and behaviours. You need to use these new tools in smart ways, embedding them into your sales execution models. In this book, you’ll discover how to: Audit the current sales techniques and cycles in your organisation Transform your sales execution models Achieve organisational buy-in through new performance measures and shared goals for success Use data to drive strategy, and revolutionise your selling with the latest digital and AI tools Build deeper buyer relationships that create more value and improve buyer outcomes With Deep Selling, you and your team will learn how to meet buyers on today’s real-world terms — and engage them more fully and successfully than ever before. This free to download offer expires July 1. How to get it Please ensure you read the terms and conditions to claim this offer. Complete and verifiable information is required in order to receive this free offer. If you have previously made use of these free offers, you will not need to re-register. While supplies last! Download How to Engage Buyers and Drive Growth in the Age of AI (worth $22.95) for free Offered by Wiley, view other free resources The below offers are also available for free in exchange for your (work) email: Excel Quick and Easy ($12 Value) FREE – Expires 6/24 The Inclusion Equation: Leveraging Data & AI ($21 Value) FREE – Expires 6/24 Microsoft 365 Copilot At Work ($60 Value) FREE – Expires 6/25 Natural Language Processing with Python ($39.99 Value) FREE – Expires 6/25 How to Engage Buyers and Drive Growth in the Age of AI ($22.95 Value) FREE – Expires 7/1 Using Artificial Intelligence to Save the World ($30.00 Value) FREE – Expires 7/1 Essential: How Distributed Teams, Generative AI, [...] ($18.00 Value) FREE – Expires 7/2 The Chief AI Officer's Handbook: Master AI leadership with strategies to innovate, overcome challenges, and drive business growth ($9.99 Value) FREE for a Limited Time – Expires 7/2 The Ultimate Linux Newbie Guide – Featured Free content Python Notes for Professionals – Featured Free content Learn Linux in 5 Days – Featured Free content Quick Reference Guide for Cybersecurity – Featured Free content We post these because we earn commission on each lead so as not to rely solely on advertising, which many of our readers block. It all helps toward paying staff reporters, servers and hosting costs. Other ways to support Neowin The above deal not doing it for you, but still want to help? Check out the links below. Check out our partner software in the Neowin Store Buy a T-shirt at Neowin's Threadsquad Subscribe to Neowin - for $14 a year, or $28 a year for an ad-free experience Disclosure: An account at Neowin Deals is required to participate in any deals powered by our affiliate, StackCommerce. For a full description of StackCommerce's privacy guidelines, go here. Neowin benefits from shared revenue of each sale made through the branded deals site.
    • Totally off topic, but... I have poked around with Ubuntu a few times, it works as expected, but I never was really into the ultra-minimalist UI. I much prefer Kubuntu! KDE feels far more at home to me than Gnome. Not just because it is more Windows-like, but because its approach of putting things on the screen to see, instead of hiding them and making you search feels so much more approachable.
    • Just tested: Disabled all the options in Advanced System Settings, except "smooth screen fonts", and the performance difference on my Ryzen 7 with 64gb memory is 100% noticeable.
  • Recent Achievements

    • Week One Done
      fredss earned a badge
      Week One Done
    • Dedicated
      fabioc earned a badge
      Dedicated
    • One Month Later
      GoForma earned a badge
      One Month Later
    • Week One Done
      GoForma earned a badge
      Week One Done
    • Week One Done
      ravenmanNE earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      656
    2. 2
      Michael Scrip
      226
    3. 3
      ATLien_0
      219
    4. 4
      +FloatingFatMan
      146
    5. 5
      Xenon
      137
  • Tell a friend

    Love Neowin? Tell a friend!