Wednesday, January 30, 2013

How to get the view and layout in Joomla 2.5

In Joomla 2.5 if you want to know the requested uri :
 $uri =& JURI::getInstance(); echo 'Request URI is ' . $uri->toString() . "\n"; 
And for the view and layout you can do the following :
echo (JRequest::getCmd('view')) ."Is the View"; 

echo( JRequest::getCmd('layout'))."Is the Layout"; exit;  
Why is that ? Because Joomla 2.5 using SEF routing that changes the requested route to a new segments related to your category's id and name as well as to the article's id and alias . Which will leads you to no where if you programming a joomla module and need to extract the coming request to check the required view and layout.

Monday, January 28, 2013

Apache 2.* Wamp Stop Working on Orange Icon

On Windows 7, Wamp server  used to run smoothly with no problems and suddenly the server stop working, if the server is ok the tray icon will be in green color, that  is sign of healthy wamp server, but now  I get only at orange color tray icon.
As usual the first thing to do in thiss case is to check the logs file to see the error message that was saved there, but another shock was there is no error message in Apache log files.

The Problem was that ,Skype is conflicting Apache because Skype use port 80 as an alternative connection port, So when Skype is started before you start apache it will use the 80 port, but if Skype is started after then port 80 will be dominated by Apache on Wamp.

What to do :
In Skype from the Main menu choose Tools then Options then Advanced and uncheck the chckbox that is titled by  "use port 80 and 443 as alternatives for incoming connections"

Happy Wamping.

Tuesday, January 22, 2013

Apache 2.* only serve the first virtual host - Windows 7 + WAMP

This is a problem that cost me 3 days googling and searching every where without any hints or clues to the way that I should take to solve this problem.
But It was very easy if you try to stop thinking that google can solve all of yourproblems , just relax and try to solve it by yourself.
That's what I did , the server was running great for more than 6 months now, and suddenly I cannot reach my virtual hosts.
My  $1 million dollar advice to any one face such a problem or any other one is "First Check Log files".
What I had there is 


[error] (OS 11001)No such host is known.  : Could not resolve host name

And that means the system don't know how to reach the name domain that you write in the address bar. So the Problem was in Domain Resolution. that lead to host file.

When I checked the host file I cannot find any problem. All virtual hosts had their right IP addresses "127.0.0.1".
But Apache Said he cannot reach this file , means  there are security rules prevent apache from opening this file. 
Yes, It is a secured file by windows and to allow any application to use this file you have to give the application the right permissions. So Apache on windows to be able to read host file and run virtual host must be "Run As Administrator". That is it .

Long Road for Dummies like me , but a very good tutorial to know that I can solve things my self.