How to create a custom page in magento and link it to a new menu

STEPS FOR CREATING A CUSTOM PAGE IN MAGENTO AND LINK IT TO A NEW MENU

1. Login as admin, Then select ‘Manage Pages’ from CMS menu.
2. Click ‘Add New Page’ Button to create a page.
3. In the New Page:

a) In General Information tab enter following details:
Page Title: Test Page
SEF URL Indentifier: test1
Store View: All Store Views
Status: Enabled
Content: Enter some text here..

b) Custome Design: Select your own layout from this tab
Select Layout: Three Column (you can select any layout)

c) Meta Data: If you want to add Keywords and Descriptions

Then click on ‘Save Page’ button. Now your test page is ready.

4. Now we have to create a new menu to link this page. Open app/design/frontend/default/default/template/catalog/navigation/top.phtml

Enter following line just above the foreach statement.

[sourcecode language=”php”]
<li><a href="<?php echo $this->getUrl(‘test1′)?>"><?php echo $this->__(‘Staff’) ?></a></li>

[/sourcecode]

Here test1 is the SEF URL Identifier and Staff is the new menu name.

Now your menu is ready.  Go to magento frontend and click on ‘Staff’ menu to see your new page.

How to install Ruby on Rails in Windows

Quick notes on how to install Ruby on Rails under Windows

  1. Open http://rubyforge.iasi.roedu.net/files/rubyinstaller/ruby186-26.exe or any later version if applicable
  2. Install to c:ruby
  3. Windows -> Start -> Run -> cmd to get the dos prompt
  4. Type PATH to ensure that it has c:rubybin; if not fix this manually via Windows control panel settings.
  5. Download http://rubyforge.rubyuser.de/rubygems/rubygems-1.1.1.zip
  6. Unzip to c:rubygems
  7. cd rubygems
  8. ruby setup.rb (this installs executable gem at c:rubybingem)
  9. delete rubygems folder
  10. gem update –system (this is to update rubygems – not needed here now)
  11. gem update (this is to update installed gems – not needed here now)
  12. gem install rails –include-dependencies
  13. MySQL – download mysql and install it, there are many ways (xampp etc)
  14. DownLoad MySQL Admin tool and connect to your MySQL
    http://mysql.orst.edu/Downloads/MySQLGUITools/mysql-gui-tools-5.0-r12-win32.msi
  15. Create a table called users
    id auto_inc
    name varchar 50
    age int 3
  16. Make a folder say c:ror
  17. cd ror
  18. rails my_first_app -d mysql
  19. cd my_first_app
  20. ruby scriptserver
  21. start browser and point to http://localhost:3000
  22. Scaffolding a table
  23. ruby scriptgenerate scaffold user name:string age:integer
  24. Edit configdatabase.yml
  25. ruby scriptserver
  26. start browser and point to http://localhost:3000/users

PHP HTTP Service Monitor

Create a PHP CLI script called monitor.php like this

  1. #!/usr/bin/php -q
  2. <?php
  3. define ( TIMEOUT , 30 ) ;
  4. define ( EMAIL , ‘ abc @ youremail . com ) ;
  5. check ( http://hosta.com ) ;
  6. check ( http://hostb.com ) ;
  7. check ( http://hostc.com ) ;
  8. check ( http://hostd.com ) ;
  9. function check ( $url ){
  10. $ch = curl_init () ;
  11. curl_setopt ( $ch , CURLOPT_RETURNTRANSFER , 1 ) ; // Return Page contents.
  12. curl_setopt ( $ch , CURLOPT_URL , $url ) ;
  13. curl_setopt ( $ch , CURLOPT_TIMEOUT , 30 ) ;
  14. curl_setopt ( $ch , CURLOPT_DNS_CACHE_TIMEOUT , TIMEOUT ) ;
  15. curl_setopt ( $ch , CURLOPT_CONNECTTIMEOUT , TIMEOUT ) ;
  16. curl_setopt ( $ch , CURLOPT_HEADER , TIMEOUT ) ;
  17. $result = curl_exec ( $ch ) ;
  18. curl_close ( $ch ) ;
  19. // HTTP/1.1 200 OK”)
  20. if ( strpos ( $result , 200 OK ) != 8 ){
  21. mail ( EMAIL , Error in $url , $results ) ;
  22. }
  23. }
  24. ?>

Add this line in your Linux /etc/crontab or via cpanel to monitor eg: every 3 minutes

*/3 * * * * root /usr/sbin/monitor.php >> /dev/null 2>&1