Archive for the ‘Web Development’ category

How To: Install Magento 1.5 on Zend Server

February 15th, 2011

So, Installing Magento on WAMP was a painful process, I gave up and switched to Zend Server as my server option as I am currently running on Windows 7.

Let me get one thing straight. Installing magento isn’t as easy as they stated in their ‘step-by-step’ guide. Well, especially on an Zend set-up.

Therefore, I will list the things I discovered you had to do to get this “amazing eCommerce Solution” to install on my local server.

The Hidden Steps

  • Firstly, you’ll need to copy your magento folder to your apache folder (assuming you’ve installed it) which is located (on my machine) C:\Program Files\Zend\Apache2\htdocs
  • Right click on this folder and untick “Read Only”, hit Apply/OK
  • Within your magento directory, lies a file called “mage”. Open this in Microsoft Wordpad (notepad doesn’t recognize the linebreaks), or any other editor that doesn’t suck
  • You’ll see a line near the top mentioning the php bin directory. Make this MAGE_PHP_BIN=”C:\Program Files\Zend\ZendServer\bin”. Remove the hash and again, relative to where YOU installed your copy of ZEND
  • Edit your hosts file (Start->Run “notepad.exe %windir%\System32\drivers\etc\hosts“) and put the desired URL for your website such as localhost.com. Example: 127.0.0.1 mymagentosite.com
  • Go to phpMyAdmin and create a database, a user and assign all privileges to this user.
  • Now, the fun part, go to the URL you entered into your hosts file where magento is stored. In our case, http://mymagentosite.com/magento
  • Complete the required fields, enter all the database info correctly and you should be set.
  • If you get a timeout error, you might need to edit your php.ini file and up the max_execution_time to around 180 as well as mysql.connect_timeout to -1

Hopefully this helps. I may have missed a step, if so, let me know if you even bother to read this blog. But I know one day, someone will, as Magento looks promising, minus their tricky installer.

Happy Coding.

Gangsta Lorem Ipsum

October 28th, 2010

For any of those web developers out there, sick of the random Latin “Lorem Ipsum” generators that are used on a daily basis for dummy-text, I present to you Gangsta Lorem Ipsum Generator

Here’s an example of what it can produce.

Cool tellizzle urna, yippiyo eu, mattis dizzle, eleifend bling bling, nunc. I saw beyonces tizzles and my pizzle went crizzle funky fresh. Integizzle sempizzle break yo neck, yall sizzle shizzlin dizzle.

Awesome aint it?

On a serious note, if you were looking for a better alternative to Lorem Ipsum, you could try a “Faux Latin” replacement such as Fillerati or Malevole

The need for dummy text is crucial to allowing clients and designers to gauge what the site will actually look like filled with content. Lorem Ipsum, although used for years in web-dev, is still problematic in providing a realistic preview/example of a web-layout due to it’s unreadable nature (unless you speak Faux-Latin. I doubt it’s as sexy as real Latin. Try getting the ladies with “Lorem Ipsum dolor sit amet” and let me know how that goes).

WordPress: Adding Bottom Menu/Navigation

August 11th, 2009

I’m going to keep this one short. Basically my template lacked a bottom menu – This is what I came up with.. You may want to tweak the settings in the wp_list_pages function to include/exclude pages or get sub-pages. See this for help.

Basically, you need to find a good spot to put this following code. I chose to put it underneath inside the “footer” div which appears in my footer.php file – Yours may be different.

	<?php
		$sortby = 'menu_order';

		$out = wp_list_pages( apply_filters( 'widget_pages_args', array( 'title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'link_before' => ' | ') ) );

		if ( !empty( $out ) )
		{
			?>

			<ul id="bottom_nav">
			<li><a href="<?php echo get_option('home'); ?>/">Home </a></li>
			<?php
				echo $out;
			?>
			</ul>
			<?php
		}
	?>

And then you add this code to your styles.css stylesheet:

	#bottom_nav
	{
		list-style-type:none;
		margin:0;
		padding:0 0 8px 0;
		text-align: center;
	}
	/* This style ensures even sub-pages will appear on the same line */
	#bottom_nav li, #bottom_nav ul, #bottom_nav ul li
	{
		display:inline;
	}

Modify this stylesheet to your liking.. you can even take out the seperator “|” character and apply it using CSS. This would require assigning an id to the first list-item (for the home item) so that you don’t apply the sepeartor to that item and then adding a left-border and some padding to the rest of the list items.

Hope this helps.

-Andrew

WordPress ‘Pages Widget’ Fix

August 10th, 2009

Basically, this quick post will be regarding the ‘Pages‘ widget, which, in hindsight, can be used in conjunction with wordpress “pages” in order to achieve a Content-Managed style site – with dynamic menu creation (in the sidebar in this instance).

 

My issue involved a few things.

 

Firstly: if I were to add a “Home” wordpress page, I’d be forced to name it “Home” in order to keep that name in the main menu. This was an undesired result, especially because most templates, including the one in question, by default, include a “Home” link anyway which links to the default page for wordpress to show (whether it be a page or the page where your blog posts are shown .. see Settings -> Reading in order to configure this).. And for my home page, I prefer the first heading to be something along the lines of “Welcome to xyz” or “Xyz Company” etc.. but at the same time I want to keep the main menu item as “Home” – this unfortuately required a workaround + hack.

 

The first thing I had to do was create a blog post as a ‘psuedo-home-page’ instead of simply just using a page. Then I had to make changes to the appropriate php files in order to remove unwanted elements (comments area, date/time, author etc..) – this may vary depending on your template – it is also out of the scope of this article.

 

The next thing was to make sure all the pages were in correct order – and that my “blog post page” was set up to be the home page (Settings -> Reading)..

 

The third thing was to find out where the pages-widget code was and put an extra line of code in to insert the “Home” link above all the other page links.

 

The file we need to edit can be found in wp-includes/default-widgets.php

 

Edit this file and find the function WP_Widget_Pages()

 

We then need to modify this code below..

function widget( $args, $instance )
{
	extract( $args );

	$title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title']);
	$sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby'];
	$exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude'];

	if ( $sortby == 'menu_order' )
		$sortby = 'menu_order, post_title';

	$out = wp_list_pages( apply_filters('widget_pages_args', array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude) ) );

	if ( !empty( $out ) )
	{
		echo $before_widget;
		if ( $title)
			echo $before_title . $title . $after_title;
		?>
	<ul>
		<?php echo $out; ?>
	</ul>
		<?php
			echo $after_widget;
	}
}

 

You now need to edit the line <?php echo $out; ?> and insert some code BEFORE it.

 

This code will grab the default home page, whichever you set it to in the settings area
and create a list item accordingly. The code is:


<li><a href="<?php echo get_option('home'); ?>/">Home </a></li>

 

Your code should now look like this:

 

function widget( $args, $instance )
{
	extract( $args );

	$title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Pages' ) : $instance['title']);
	$sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby'];
	$exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude'];

	if ( $sortby == 'menu_order' )
		$sortby = 'menu_order, post_title';

	$out = wp_list_pages( apply_filters('widget_pages_args', array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude) ) );

	if ( !empty( $out ) )
	{
		echo $before_widget;
		if ( $title)
			echo $before_title . $title . $after_title;
		?>
	<ul>
	        <li><a href="<?php echo get_option('home'); ?>/">Home </a></li>
		<?php echo $out; ?>
	</ul>
		<?php
			echo $after_widget;
	}
}

 

Save the file and that’s it. You now have a valid Home link in your pages widget.