kreoton web development

Archive for the ‘Uncategorized’ Category

[PHP] building recursive menu with MySQL and without it

Thursday, March 13th, 2008

Today I decided to share with you with two my function that I use in my code to build navigation menu for websites. First function is to build menu formated in PHP array. First we must format our menu in array like this way:

$menu = array(
	'Home' => $base.'/',
	'Videos' => array (
		'_link' => $base.'/videos/',
		'_submenu' => array (
			'Categories' => array (
				'_link' => $base.'/videos/categories',
				'_submenu' => array (
					'Fun videos' => $base.'/videos/categories/fun_videos',
					'Home videos' => $base.'/videos/categories/home_videos',
				),
			),
			'Popular' => $base.'/videos/popular',
			'Best rated' => $base.'/videos/best-rated',
		),
	),
	'Articles' => array (
		'_link' => $base.'/articles',
		'_submenu' => array (
			'Newest' => $base.'/articles/newest',
			'Archive' => $base.'/articles/archive',
		),
	),
	'Contact Us'=> $base.'/contact_us'
);

Variable $base is holding url to our website and is defined like this:

$base = 'http://www.example.com';

(more…)

File saving on FTP with gEdit in Linux (Ubuntu)

Monday, October 29th, 2007

Last weekend i spend searching the net for good php editor in Linux. I downloaded about 10 of php editors: Quantana, Vim, Kate and others, but the best editor i found is gEdit. But it has one little problem in base configuration it can not save files directly to ftp but this can be sloved:

1. Hit Alt + F2 on your keybord
2. Enter gconf-editor
3. Navigate to  /apps/gedit-2/preferences/editor/save/
4. To  writable_vfs_schemes parameter add ftp

Now you can directly save files to your ftp.