blog icon

PHP variables inside external CSS

There’s a way of using php variables inside your css external file.
First, you have to rename your css file to “mycssfile.php”.
Then, insert the following line of code on top of the file:

  1. <?php header("Content-type: text/css"); ?>

Finally, don’t forget that the reference to the css file in your HTML is “mycssfile.php”.

Inside “mycssfile.php” you can define variables like colors, typography, measures, etc…

  1.  
  2. <?php
  3. $color1 = "#CCCCCC";
  4. $color2 = "#FFFFFF";
  5. $type1 = "Helvetica";
  6. etc…
  7. ?>
  8.  
Filed under: Blog, Tutorials

Random Image using PHP

Ok… this is really going to be simple.
You want to display a random image inside, lets say, a header div.

For the sake of simplicity, put all the images you want to display inside a folder and name them something1.jpg (or png, or gif, or whatever), something2.jpg, something3.jpg, etc…

Now you only have to generate a random number using the php rand() function. This function may receive two parameters: a minimum value and a maximum.
Example: rand(1,30) will return a number between 1 and 30 (inclusive).

In this example I have only 5 images inside a “images” folder. They are named “img1.jpg”, “img2.jpg”, etc…

Filed under: Blog, Tutorials

Inspiring magazines #2


Root Magazine

Now you can collaborate with us to carry on this project … your help will be greatly appreciated.
In no issue is there a specific subject to work on. Rootmagazine is simply a space for everybody who is willing to exhibit graphic design, illustration, photography, video, audio, etc…
You are the artists and rootmagazine is the showcase for what really represents you.
We will upload your works inside our magazine with full respect to your style.

Filed under: Blog

Inspiring magazines #1


NEWWORK Magazine

NEWWORK magazine is a large-format arts publication for conneusiers of fresh ideas. Designed and published biannually by studio NEWWORK, each issue features new work from a wide range of artists and creators in the worlds of fine art, design, high fashion, culture, and politics. From art directors to business leaders, design students to curators, NEWWORK’s contributors are united in their passion to push the boundaries of their disciplines. Among the magazine’s special features are bold, custom-designed typefaces and a twist on the traditional newspaper format, offering a stimulating juxtaposition of striking design and everyday simplicity. Since pages can be separated, each layout can be hung on the wall as an individual art piece.

Filed under: Blog
Filed under: Blog
Page 1 of 812345»...Last »