How to have random header image WITHOUT plugin :)

First of all I needed script for that. Very good one I found on Photo Matt site. Here is a copy:

<?php
/*
By Matt Mullenweg > http://photomatt.net
Inspired by Dan Benjamin > http://hiveware.com/imagerotator.php
Latest version always at:
http://photomatt.net/scripts/randomimage
*/// Make this the relative path to the images, like "../img" or "random/images/".
// If the images are in the same directory, leave it blank.
$folder = ”;
// Space seperated list of extensions, you probably won’t have to change this.
$exts = ‘jpg jpeg png gif’;
$files = array(); $i = -1; // Initialize some variables
if (” == $folder) $folder = ‘./’;
$handle = opendir($folder);
$exts = explode(’ ‘, $exts);
while (false !== ($file = readdir($handle))) {
foreach($exts as $ext) { // for each extension check the extension
if (preg_match(’/\.’.$ext.’$/i’, $file, $test)) { // faster than ereg, case insensitive
$files[] = $file; // it’s good
++$i;
}
}
}
closedir($handle); // We’re not using it anymore
mt_srand((double)microtime()*1000000); // seed for PHP < 4.2
$rand = mt_rand(0, $i); // $i was incremented as we went along
header(’Location: ‘.$folder.$files[$rand]); // Voila!
?>

I saved that as a file: rotate.php.

Continue Reading »

Links look and feel ;)

I know that what I’m going to write now is rather obvious. But my memory despite of being good is short as well ;).
So just to have place I can check how I changed look of links in posts.
In .css file there is something like this (.css for MistyLook theme):

#content .entry a:link, #content .entry a:visited
{
border-bottom:#963 1px dashed;
}
#content .entry a:hover, #content .entry a:active
{
border-bottom:#963 1px solid;
}

So all links were underlined with dashed line. Also thumnails linked to full sized pictures. And they already had frames so together with underline it looked not nice ;).

I changed code to:

#content .entry a:link, #content .entry a:visited
{
border-bottom: none;
font-weight: bold;
}
#content .entry a:hover, #content .entry a:active
{
border-bottom: none;
font-weight: bold;
}

Now there is no underlined links but text hyperlinks are still well visible :).

Pics via WPG2

First plugin I used to show pics on my page was WPG2. I didn’t use it much as soon I discovered d13gallery plugin which offers options that much better meet my needs. I can have thumbnails linked to full size photos which is perfect solution for me.
Recently I wanted to use WPG2 again and I encountered problems. I couldn’t neither download pics nor to display it. More over pics that I already had on my site didn’t linked to Gallery2 any more…
It took me few loooong hours to find out reason ;). Which - of course - was so obvious!
I didn’t take into consideration fact that in the meantime I moved my site from sub-folder to main domain. When all my attempts to link thumbnail with Gallery2 again failed I looked to ‘Manually Configure/Adjust Embedded Paths’ option available at WP admin panel.
Yupi!
It looked like that:
Gallery2 URL: http://www.domain.com/gallery2/main.php
URI to Gallery2 Embed Page (wp-gallery2.php): http://www.domain.com/sub-folder/wordpress/wp-gallery2.php
Gallery2 File Path: /usr/name/public_html/gallery2/
On Gallery Error Redirect to: http://www.domain.com/sub-folder/index.php.

All I had to do was to remove /sub-folder from URI to Gallery2 Embed Page and URl used in case of Gallery Error…

Problems with pics

I tried to upoald pics on my main site but have encountered problem. Pics were uploaded but I couldn’t Edit them at all. For some reason available options just ‘refused’ to cooperate! ;)
Fortunately I could check here an html code :).

So just in case that’s the way it should look like:

<p style="text-align: center"><img src="http://www.nietoperzka.com/wptraining/wp-content/uploads/2007/06/pic1.JPG" ALT="pic1.JPG" /></p>

Test for pics upload :)

That’s my cat.

mycat.JPG

Inserting images

Wrrrr….. There is a really big difference between WP 2.0.2 I’m using on my main page and 2.1 I’m using for experiments.
I’ve tried to insert image into post using option “Upload file..”. But every time I got message: “The uploaded file could not be moved to”. Hmm… And what does it really mean?

So I tried the same trick here. And I got following message:
“Unable to create directory (…) httpdocs/wptraining/wp-content/uploads (…). Is its parent directory writable by the server?”

And I knew answer! My folder wp-content/uploads wasn’t writeable ;). So simple…

YES!

I resolved problem of sections on the page. And sidebar dropping down. That was of course matter of HTML ;).

It should look like this:

<p>content of 1st section<br />
<!–nextpage–><br />
content of 2nd section</p>
<p><!–nextpage–></p>
<p>content of 3rd section</p>
<p><!–nextpage–></p>
<p>content of 4th section </p> and so on…

The first section shouldn’t end with < /p >. So simple that I couldn’t figured it out at the beginning :).

Headers

I need to test HEADERS.
There is many posts too long to be displayed as a one. I tried to divide them into pages using ‘page break’ but… then a sidebar drops down (strange -> only in the first and last page, never in the middle). So I found something called headings. We will see….
<h2>Post</h2>
This post need to be divided :).

Hm…. That’s not exactly what I meant… No changes ;). Just looks funny.

Changing the look without knowledge of HTML

Long break - > two weekend trips and very busy week in between (including rather serious illness). But back here.
I was wondering how to learn changing major parts of site layout without getting into serious troubles. And there is some idea. I got info about Nvu project. This program allows to create web sites without any knowledge of HTML. You can design your site the way you edit any text editor. But there is cool option. One of tabs you can see while editing is “HTML”?. It’s this part of Nvu program that shows how your page will look in HTML language. And here is the point! I can edit site and then check what kind of changes it causes in HTML script!

Link plug-in test

Ok. I found something. Let’s check if it leads to my special site. Man…. Now I realised there is no need for link plug-in! New version of WP has it built-in ;).

Page 5 of 6«123456»