301 .htaccess redirect

Sometimes we need to redirect old links to new pages, it`s very easy.

Redirect 301 /oldpage.php http://newlink/newpages.php

Публикувано в Joomla, linux

rsync sync directories with resume

rsync -rPtz –progress -e ssh /local_backup_path/ remote_host:/remote_backup_path/

The -e ssh tells rsync to use a ssh client instead of rsh. The -z option compresses the file. -t preserves time attributes and the -P option resumes incomplete file transfers.

If you run this command from the command line you can use the –progress option, that will show you a progress bar during transfer. Very useful with large files.

С етикет: , ,
Публикувано в linux

strip first words from a string

<?php echo implode(‘ ‘, array_slice(explode(‘ ‘, strip_tags($introtext) ), 0, 30));?> …

С етикет: , , ,
Публикувано в Joomla

preg_match_all image

$matches = array();
preg_match_all(‘/<img.+src=[\'“]([^\'“]+)[\'“].*\/>/i’ , $article->text , $matches);

if($matches[0][0]){
echo $matches[0][0];
}

С етикет: , , , , ,
Публикувано в Joomla