Archive

Archive for the ‘MYSQL’ Category

install php mysql apache and secure mysql at ec2 instance

October 14, 2014 Leave a comment

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/install-LAMP.html

Advertisements
Categories: aws, linux, MYSQL, php, Web

How to extract the query string parameters.

January 20, 2011 Leave a comment

This was simplest method that i found very much help full, to extract the query string parameters .

  1. <script type=”text/javascript”>
  2. function getParameter(queryString, parameterName){
  3. var parameterName = parameterName + “=”;
  4. if ( queryString.length > 0 ) {
  5. begin = queryString.indexOf ( parameterName );
  6. if ( begin != -1 ) {
  7. begin += parameterName.length;
  8. end = queryString.indexOf ( “&” , begin );
  9. if ( end == -1 ) {
  10. end = queryString.length
  11. }
  12. return unescape ( queryString.substring ( begin, end ) );
  13. }
  14. return “null”;
  15. }
  16. }
  17. /* now we can call this javascript method as follows */
  18. var queryString = window.top.location.search.substring(1);
  19. var urlStr = getParameter(queryString, ‘url’);
  20. </script>

Thanks to mohsin who shared this code with me .

MVC & Php.

December 4, 2010 Leave a comment

Model–View–Controller (MVC) is a software architecture, currently considered an architectural pattern used in software engineering. The pattern isolates “domain logic” (the application logic for the user) from the user interface (input and presentation), permitting independent development, testing and maintenance of each (separation of concerns).

MVC using Php.

There are multiple frameworks/open source  CMS that are using MVC as a architectural patterns e.g. cake php, joomla , etc .

Lets us discuss as much as we can

Cake Php: (http://cakephp.org/)

CakePHP is a rapid development framework for PHP that provides an extensible architecture for developing, maintaining, and deploying applications. Using commonly known design patterns like MVC and ORM within the convention over configuration paradigm, CakePHP reduces development costs and helps developers write less code. Read more…

Add extension to Dreamweaver (e.g. “.thtml/cpt” for cakephp)

January 4, 2010 2 comments

To  Configure Dreamweaver 3  to Opening CakePHP .thtml  CTP Files you need to  edit following three files:-

  1. Extensions.txt( program files)
  2. MMDocumentTypes.xml
  3. Extensions.txt(document and settings)

C:\Program Files\(Adobe/Macromedia)\(Dreamweaver-cs3)\configuration\extensions.txt

Open “Extensions.txt” and  add “THTML” and “CTP” separated by commas, so the line should read:

,MASTER,THTML,CTP:All Documents

,MASTER,THTML,CTP:All Documents

Similarly add these two extensions to the “:PHP Files” line.

PHP,PHP3,PHP4,PHP5,TPL,THTML,CTP:PHP Files

PHP,PHP3,PHP4,PHP5,TPL,THTML,CTP:PHP Files

Next open the “DocumentTypes” folder and edit the “MMDocumentTypes.xml” file, just open it up using notepad or wordpad. Search for the line which has an id “PHP_MySQL” and add the THTML/CTP file extensions to both the “winfileextension” and “macfileextension” so the line should read:

  1. winfileextension=“php,php3,php4,php5,thtml,ctp”
  2. macfileextension=“php,php3,php4,php5,thtml,ctp”

above two files editing will enable you to open the file in dreamweaver but if you want to enable dreamweaver search for these two extentions then do the final step as follows:

winfileextension=”php,php3,php4,php5,thtml,ctp”

macfileextension=”php,php3,php4,php5,thtml,ctp”

An another version of the “Extensions.txt” which is located in your “Documents and Settings” Folder e.g. in my case this is “C:\Documents and Settings\khalidrauf\Application Data\(Adobe or Macromedia)\(Adobe )Dreamweaver(version)\configuration” just add the very same things you inserted earlier in “Extensions.txt” .

How to develop my own CMS using ruby on rails

How to develop my own CMS using ruby on rails

  1. Create project using rails

Rails myCMS –d mysql

  1. Create admin controller

Ruby script/generate controller admin  index 

Rails script/generate controller admin  index

  1. Create  controller home

Ruby script/generate scaffold admin/home  address:text 

Rails script/generate scaffold admin/home  address:text

  1. Edit admin controller ( index)

redirect_to :controller=>”/admin/home”,:action=>”index”

  1. Set route configuration file to redirect the admin/ to admin/home as follows

map.resource  :controller=>”admin”

  1. Set route configuration as follows

Map.namespace(:admin) do |cmsroot|

Cmsroot.resource :home

End

After running server

Browse following link Read more…