Earthtracker's Blog

Just another WordPress.com weblog

Expressionengine template routes for first segment with regular expression

EE has a great tool for template routing, Developer sometimes faces problem with dynamic segment routing on first segment, then we need to use regular expression using regex. I didn’t find enough details about this on EE template routing docs. So after long hours of try, solved it.

Here is the example explained:
Club name should start with club here.

If the desired url like : domain.com/club-expresso/profile/shahed


{variable:regex[(club)]}/profile/{url_title}

Simple but very much useful!

Leave a comment »

Expressengine Assets file upload +no directory access in Channel form

Expressionengine Assets dont have any features to restrict file upload directory on channel form. So we use normal file input fields. But there is problem, it remove the selected file when next time the file is not updated.

So here the solution:
{member_photo}

<img src=”{url}” alt=”” />

<input type=”hidden” name=”member_photo” value=”{file_id}” id=”cur_file_id”>

<input type=”file” name=”member_photo” id=”file_upload”>

<input type=”hidden” name=”member_photo_filedir” value=”8″>

{/member_photo}

jQUery:
$(“#file_upload”).change(function (){ $(‘#cur_file_id’).val(”); });

Leave a comment »

Skype Crash issue on Ubuntu after upgrade

I have using older version of skype on my ubuntu 10.4, after upgrade skype version 4.3, it seems have a crash issue. So here is the solution , if you have similar problem.

Go to Your user directory Like /home/[Ubuntu user folder]/.Skype/
Usually .Skype directory is hidden.
Rename it like .Skype_temp and run skype again, It will works, and another .Skype directory will be created.

Now if you like to get the old chat history, copy the files from
/home/[Ubuntu user folder]/.Skype_temp/[Skype user account folder]/chatsync

to New .Skype Directory:

/home/[Ubuntu user folder]/.Skype/[Skype user account folder]/chatsync

This should solve the problem.

Cheers!

2 Comments »

Some useful links for UI / Web designer

Website check in different Resolution including Desktop, laptop, Tablet devices:

http://www.infobyip.com/testwebsiteresolution.php

So now you dont need to use different devices to check, Just sit back on your pc and check all here at once! I really appreciate this project.

For different browsers compatibility check, you may use some useful links: http://designm.ag/resources/browser-testing/

So no worries for UI, have fun!

Leave a comment »

Magento Canonical URL problem from outside of main category solve

In magento , if you add a product in categories multiple categories, and like to display product from outside of the categories, it will no reflect the correct url, it will create a url with the domain name + product url title,It will cause duplicate contents in google, to resolve the problem, here is the solution,My special thanks to http://stackoverflow.com/questions/10997108/magento-getproducturl-is-not-returning-the-right-url/17895371#17895371

$cat_count=count($_categories);

   if($cat_count>0){

   if($_categories[0]==2) // here 2 is root category id

   $cat_count=$cat_count-1;

   else

   $cat_count=$cat_count-2;}

   $_categories = $_product->getCategoryIds();

   $_category = Mage::getModel('catalog/category')->load($_categories[$cat_count]); 

   $caturl=explode('.html', $_category->getUrlPath());      
      
   $product_url = Mage::getUrl($caturl[0]).basename($_product->getProductUrl()); 

Leave a comment »

Enable welcome HTML mail and error fix on Expressionengine user module (by Solspace)

I have been facing problem with the solspace user module’s welcome mail template enable HTML format, when i tried input inline styling , there was an error from ee security.
as template input is filtered by ee()->security->xss_clean, which used to test images for potential XSS attacks, useful for file upload security, I don’t think this should use here, as the html template can be updated by EE admin only.

To resolve this , i have changed the line from mcp.user.base.php
‘preference_value’ => ee()->security->xss_clean($_POST[$pref]),
to
‘preference_value’ => $_POST[$pref]

also to enable HTML formatted email you have to change the file:
mod.user.php line near the line : 5636, add ee()->email->mailtype = “html”; after : ee()->email->initialize();

This should resolve the issue, Cheers!

Read more

1 Comment »

Fix buddypress global.js and Jquery easing conflict

I have been facing problem with the buddy press and Promotion slider,
The promotion slider was stop working after buddy press installation.

It seems there was a conflict between buddypress’s global.js and jquery easing , the error console said “f.easing[e.animatedProperties[this.prop]] is not a function”, After a huge brain storm i got a solution, It seems using a updated easing plugins after the global.js, will solve the problem.

You can find the plugin : Click here

Thanks

Leave a comment »

WordPress name in url string 404 page problem fix

I have been facing a problem in wordpress , when i was passing name string in page url like this format:
http://www.example.com/main/?item=5&cemail=testme%40test.com&ccountry=AU&name=testme
this taking me to 404 page.
if i remove the name parameter, then it was ok.
I have a got a good solution.
just write the following code in the file : root-> wp-config.php

unset($_GET['name']);

It was solved!

4 Comments »

Importing SQL dump in ubuntu

mysql  -u<username> -p  <database-name> < somedatabasetable.sql
Leave a comment »

Setup virtual host in ubuntu

Setup virtual host in ubuntu is pretty simple.

Hope you have already apache2 installed.

Now go to the location: /etc/apache2/sites-enabled
Open the file named ‘000-default’ as root.

You will find some line for default localhost .

<VirtualHost *:80>
	ServerAdmin webmaster@localhost
       DocumentRoot /var/www
	<Directory />
		Options FollowSymLinks
		AllowOverride All
	</Directory>
......

Add the following line

ServerName localhost

Now copy the full section between

<VirtualHost *:80></VirtualHost>

under this part .
Change the code like below.

<VirtualHost *:80>
	ServerAdmin webmaster@localhost
	ServerName mydomain.com

	DocumentRoot /var/www/project-folder-name/
	<Directory />
		Options FollowSymLinks
		AllowOverride All
	</Directory>
	<Directory /var/www/project-folder-name/>
		Options Indexes FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		allow from all
	</Directory>

.......... 
</VirtualHost>

Others will remain same.

Save the file.

Now fine the host file from /etc/hosts
Add the following line

127.0.0.1	mydomain.com

Save the file.

Now restart your apache.
sudo /etc/init.d/apache2 restart

Enjoy browsing your new virtual host.🙂

Leave a comment »

Follow

Get every new post delivered to your Inbox.

Join 280 other followers