Posts

Showing posts from October, 2015

\r\n not working for new line in php

Try this:
echo str_replace(array("\r\n","\r","\n"),'<br>',$message);// or echo nl2br($message);

add button group using bootstrap

Bootstrap allows you to group a series of buttons together (on a single line) in a button group:
Use a <div> element with class .btn-group to create a button group:
Example<divclass="btn-group">
<buttontype="button"class="btn btn-primary">Button 1</button>
<buttontype="button"class="btn btn-primary">Button 2</button>
<buttontype="button"class="btn btn-primary">Button 3</button>
</div>

How to add active class to codeigniter?

try this one.i think no need of javascript or jquery.
If you are using codeigniter then you can use URI Class.
<liclass="home"> <a class="<?php if($this->uri->segment(1)=="search"){echo "active";}?>" href="<?=base_url('search')?>"> <iclass="icon-search"></i><span>BEDRIJF ZOEKEN</span></a></li>

Write query in codeigniter view file

You could try this...
<?php $CI =& get_instance(); $query= $CI->webpages->get_where_custom('parent_id',0);foreach($query->result()as $row){ $query1=$CI->webpages->get_where_custom('parent_id',$row->id);foreach($query1->result()as $row1){ $row1->id;}}?> It's not according MVC rule but it's possible.
More details

Replace multiple characters from string in php

str_replace() can take an array, so you could do:
$new_str = str_replace(str_split('\\/:*?"<>|'),' ', $string); Alternatively you could use preg_replace():
$new_str = preg_replace('~[\\\\/:*?"<>|]~',' ', $string);or str_replace(array(':','\\','/','*'),' ', $string);

Fatal error: Call to undefined function base_url() in CodeIgniter

You have to load the url helper to access that function. Either you add $this->load->helper('url'); somewhere in your controller. Alternately, to have it be loaded automatically everywhere, make sure the line in application/config/autoload.php that looks like $autoload['helper']= array('url'); has 'url' in that array (as shown above).

Read More

Set language in codeigniter

First we need to configure the necessary files before we can start using language support. The CodeIgniter config file, located in the application/config directory, contains an option called language which defines the default language of the application.

<?php
$config['language'] = 'english';

First we need to configure the necessary files before we can start using language support. The CodeIgniter config file, located in the application/config directory, contains an option called language which defines the default language of the application.

<?php
$config['language'] = 'english';

We also need to create the actual files which contain our messages in different languages. These files need to be placed inside the application/language directory with a separate directory for each language. For example, English language files should reside in the application/language/english directory, and French language files should be located in application/language/french…

Remove index.php from url in codeigniter

Try It. Open config.php and do following replaces $config['index_page']="index.php" to $config['index_page']="" In some cases the default setting for uri_protocol does not work properly. Just replace $config['uri_protocol']="AUTO"by $config['uri_protocol']="REQUEST_URI" HTACCESS RewriteEngine on RewriteCond $1 !^(index\.php|resources|robots\.txt)RewriteCond%{REQUEST_FILENAME}!-f RewriteCond%{REQUEST_FILENAME}!-d RewriteRule^(.*)$ index.php/$1 [L,QSA] View More at Stack Overflow

How to move Prestashop from localhost to domain (or vice versa)

Image
This article describes how to migrate Prestashop installation from your PC (localhost) to your domain. The reverce process is pretty much the same. On localhost I’m using XAMPP, which works well for Prestashop without setting any special parameters. Reference from premium-templates

1) Copy all files from from localhost to your FTP, usually into root folder or folder like “shop” 2) Backup database from localhost Login to phpMyadmin on localhost (http://localhost/phpmyadmin/), select your database to see all the tables. Click on export tab. You can use “Quick” method to export it as .sql file or choose “Custom” and export database as compresssed file (zipped, gzipped, bzipped). I recommend compress the database, so you can upload smaller file in next step.

3) Import database on hosting server Again, login to phpMyAdmin, select your database (usually you have to create it in administration of hosting account). Make sure your database has setup same collation (usually utf8_gener…