Welcome to slayer’s blog | Web Design tips & tutorials
HomeAbout Me
Scripts, Tutorials

Archive for the ‘Scripts’ Category

This entry was guestblogged by lorz.

Have you ever wanted to snatch the source code of a webpage in order to get some information like the title, meta-tags or even some parts of the body? For example, suppose you know a website with weather forecast. Now you would like to have some weather forecast on your website too, but you do not want to update it manually.

In this post, we are going to build a simple function to get the source code of a specific url.

We start by defining our function with a single argument: $url;

function source_code ($url) {

Now we check to see if the function named curl_init exists.

if (function_exists (’curl_init’)) {

If the condition returns true, we grab the source code with the help of curl. First we have to initiate in a variable called $curl. Simple!

$curl = @curl_init ($url);

Now we define some options for $curl. CURLOPT_HEADER is used for including the header of the page. We do not need it. So we are going to set it to FALSE.

After this, we have CURLOPT_RETURNTRANSFER which we will set to TRUE because we want our source code returned as a simple string.

After this, we have CURLOPT_FOLLOWLOCATION, and we will set it to TRUE so that the script will follow any header(”Location:”) redirects.

And the last option is CURLOPT_USERAGENT, and this will be our $_SERVER['HTTP_USER_AGENT']), the User’s browser actually.

@curl_setopt ($curl, CURLOPT_HEADER, FALSE);
@curl_setopt ($curl, CURLOPT_RETURNTRANSFER, TRUE);
@curl_setopt ($curl, CURLOPT_FOLLOWLOCATION, TRUE);
@curl_setopt ($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);

We finally get the source in $source, close curl, and return the results.

$source = @curl_exec ($curl);
@curl_close ($curl);
return $source;

Now we define our else condition, which will be used if curl_init does not exist. We simply use file_get_contents() to get the source code.

} else {
return @file_get_contents ($url);

To finish, we close both braces.

}
}

And that’s it! Now you have a fully working source code grabber script!

With some delay Wordpress 2.5 was finally launched yesterday. This is a long waited version and it features lots and lots of new features and even more flexibility.

The whole admin panel got a facelift, good bye old theme, welcome new web 2.0 theme. As you can see the most commonly used features are way more highlighted than the less commonly used features(like plugins for example: you activate the plugins once and you won’t have to use the plugins tab till you upload a new plugin.

The use of widgets also invaded the admin panel! The dashboard contains a series of widgets which you can easily edit.

Along with the new release wordpress achieved a great milestone and wordpress.org also got a facelift. It was about time you guys!

The new wordpress admin panel has some really neat features, but the thing that i like the most is that it’s organized and even more simple to navigate and manage your blog.

The boxes are completely reordered which are like a STEP-BY-STEP guide on how to write your posts.

For example:

- you start with writing the post

- after which you add tags

- you select the categories

- use custom fields

-set commenting/trackback settings

- select author

When writing a post the permalink is generated and shown, which you can edit in real time at a simple push of a button:

You can instantly add and delete tags without reloading the page using the Tags box features:

Adding pictures/videos/audio/media/ is just one click away using the Add Media feature:

Also the WYSIWYG editor got a new look, and the newest feature that i love is the REDO button, because sometimes when i messed up something i pressed Ctrl+Z by reflex and couldn’t redo it

Wordpress 2.5 is truly a revelation. It gives you the flexibility you need and the feeling that your using a very advanced CMS with all the settings at the tip of your fingertips.

Upgrading to wordpress 2.5 won’t really affect your blog, because 2.5 supports themes and plugins made for older versions of wordpress, although as i saw there are a few plugins that are incompatible with 2.5.

Currently i’m at college(damn…some classes are just way too boring), but tomorrow i will try to make a video overview of wordpress 2.5.

Till then here are some helpful links for you:

http://wordpress.org/development/2008/03/wordpress-25-brecker/

http://wordpress.org/development/2008/03/wordpress-25-rc2/

Lets take it from the beginning, what exactly is Seedor? Seedor is a content management system; a script that helps you build and manage your website. Seedor is full of many features like: Simple to use WYSIWYG, Site Statistics, Visitor Information, Easy to use Layout, Fun and useful modules, Easy to modify coding. The brief intro found on the main website sounds very promising, shortly seedor is a heavyweight CMS full with features.

Lets jump to the installer:
- When you run the installer it automatically checks that are the required files writeble and is your PHP version suitable to run Seedor on it(pretty helpfull in my opinion , you wouldn’t want to install a CMS and after you installed it to see dozens of query errors),
- The installer is extremely easy to use with all the detailed info next to every field, meaning that EVERYONE can install Seedor, even beginners in the world of CMS’s.

The Admin Panel:
- As you access the admin panel you will notice a message in red “Install Folder Please Delete this folder. It could be used to hack your CMS.” This notification is one of the most important notifications, since not deleteing the install folder can trully compromise your website.
- Just as everyone by curosity you will probably access the front end of your website to check that is everything ok, and does it really look like as the demo shown on the official website. At this point you will get a big surprise seeing no index at the frontend of your website. By this time you will probably check that did you upload everything. When you realize that everything is ok and you still don’t have an index you will probably write a support ticket to the seedor CMS staff.
- An other thing that isn’t suitable nor for a Free cms nor for a payed one is to see ads in the admin panel. Ads don’t belong in admin panels!
- The configurations are organized in the left sidebar.

Site Management tab:
-here you can change the template of the frontent, check a detailed list of your visitors featuring ip/browser agent/refferer/visits and ofcourse ability to ban. The navigation link however throws you back to main admin panel overview.

Admin Management tab:
- here you can add admins and edit them…it has lack of features like admin levels and privileges, this can cause a security risk also in the way that you create other admins and they can delete main root admin account.

Media Center:
You can upload differnet types of media files,everything is ok till now
here is the faq that you can see on bottom of the table after you uploaded the image:
“There are many ways you can see your gallery of photos, below is a basic way to make a page a media page on Seedor CMS (Via Page Manager):

1. Click Add New page (You can’t edit pages to meda right now).
2. Go to ‘Page Options’ then, tick yes for the box saying ‘Media Page’.”

lets move to add a page section - i done everything TWICE as it said but the image/gallery won’t show up.

Advert Management:
You can easily add advertisements like adsense/clicksor/ypn or just simple image ads, but here’s the big question: where will the ads show up? there isn’t a setting that offers you the possiblity to set ad zones.