PHP-GTK2 Cookbook Forum
Welcome, Guest
Please Login or Register.    Lost Password?
Success story (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Success story


#4482
jimbrooking (User)
Fresh Boarder
Posts: 15
graphgraph
User Offline Click here to see the profile of this user
Success story 2 Years ago Karma: 0  
I am posting this in the hopes that it will help someone. Below I describe how I use DirectPHP and the easy solutions to the three problems I encountered when migrating a bunch of PHP pages from the PHP Pages component in J1.5 to DirectPHP in J1.6.

To start, my J1.6 template is Blend-Education, which I have modified somewhat to better match our J1.5 web site at http://www.fearringtonfha.org/. The installation of DirectPHP went without a hitch.

In converting my PHP filesI ran into three problems, each easily corrected.

First, here's how I moved my PHP pages from 1.5's PHP Pages component directory to 1.6:

  1. Copy code from its 1.5 directory location into a blank PHP page in NetBeans.

  2. Edit code in NetBeans

  3. Copy code from NetBeans window (CTRL-A, CTRL-C)

  4. Paste into article's Content window (CTRL-A, CTRL-V) in 1.6 article editor

  5. Test page

  6. Repeat steps 2-5 as necessary until the page works.


The three problems I encountered in getting the pages to work in 1.6 were


  • The stuff you put into the 1.6 content editor has to be a pure PHP file bracketed by <?php ... ?> So anyplace where I'd escaped from PHP with a ?> (e.g., to insert Javascript, HTML or CSS) then re-entered PHP with a <?php had to be changed to the PHP echo statement's "here document" syntax. (See http://php.net/manual/en/function.echo.php for a description.) In short, you
    remove the ?> exit PHP and the subsequent <?php resume PHP code statements and enclose the non-PHP stuff in the PHP echo statement:
    Code:
    		
    		echo <<<AnyString
    		[non-php statements]
    		AnyString;
    
    (The "<<<" is exactly three left-angle-brackets; the closure of the quote is the opening "AnyString" at the beginning of the line followed by a semicolon and nothing else.)
  • Within non-quoted non-PHP text, i.e., if you want the value of a PHP variable to appear in the non-PHP code a valid construction is <?=$TheVariable?>. This is shorthand for
    Code:
    		
    		<?php
    		echo $TheVariable;
    		?>
    
    However, when solving the first problem above, any occurrence of the <?=...?> syntax will result in PHP code imbedded in PHP code, which causes an error. The fix is trivial: just remove the bracketing <?= and ?> leaving only the variable imbedded, and that solves the problem.
  • For some reason, "mailto:-type hrefs" in <a>...<.a> links don't work when in the echo <<< format. They did not work after the Email Cloaking Module did its thing. So at the beginning of each of my PHP pages that contained a Mailto: link I inserted the following line
    Code:
    {emailcloak=off}
    
    and that made the email links function correctly.
Otherwise everything works exactly as expected (as it did under 1.5), so converting the remaining PHP pages became just a matter of identifying and correcting the problem areas above. I might suggest that if a PHP syntax highlighter was added to the Joomla editor as part of this plug-in, the round trips between NetBeans and the J1.6 editor would become less necessary. As it is, with all the PHP code un-indented and not highlighted or syntax-checked at all, it's difficult to find, much less debug code using the J1.6 editor. Conclusion: Thanks for a nice solution to a difficult (for me) problem.
 
  The administrator has disabled public write access.

#4486
kksou (Admin)
Admin
Posts: 1680
graph
User Online Now Click here to see the profile of this user
Re:Success story 2 Years ago Karma: 27  
Hi Jimbrooking,

Thanks much for sharing.

I'm sure this will save a lot of time for many people.

I will try to consolidate some of your things here into the DirectPHP FAQ.

Thanks and Regards,
/kksou
 
  The administrator has disabled public write access.

#4606
IamJim (User)
Fresh Boarder
Posts: 6
graphgraph
User Offline Click here to see the profile of this user
Re:Success story 1 Year, 10 Months ago Karma: 0  
I also thank you. New to DirectPHP and mainly testing now with new J1.6 but I am sure this will come in handy should I upgrade any existing sites.
 
  The administrator has disabled public write access.



Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Blog - Forum - Privacy Policy - Contact Us
Links - Classes - Social Business - BPM - Web - General
Copyright © 2006-2013. kksou.com. All Rights Reserved