Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

PHP script
 
rEda
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-08-08
 

Hi,

i’m bigining in MAGENTO, and i have a PHP script that i want to execute and display it into the home page.

i dont now how to do it !!

thank you

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikefido
Guru
 
Avatar
Total Posts:  481
Joined:  2008-07-11
New Haven, CT
 

Check out this thread: http://www.magentocommerce.com/boards/viewthread/3698/

Particularly check out posts by the member Moshe (esp the first post on the 2nd page of that thread)

 
Magento Community Magento Community
Magento Community
Magento Community
 
rEda
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-08-08
 

thank you very much

i tried the solution explained by Moshe, but noting was displayed on my CMS page, and i don’t now why !!!

and my code :

1- C:\wamp\www\magento-1.1.2\magento\app\code\local\Reda\Custom\etc\config.xml

<?xml version="1.0"?>
<config>
  <global>
    <
blocks>
      <
reda_custom>
        <class>
Reda_Custom_Block</class>
      </
reda_custom>
    </
blocks>
  </global>
</
config>

2- C:\wamp\www\magento-1.1.2\magento\app\etc\modules\Reda.xml

<?xml version="1.0"?>
<config>
  <
modules>
    <
Reda_Custom>
      <
active>true</active>
      <
codePool>local</codePool>
    </
Reda_Custom>
  </
modules>
</
config>

3- C:\wamp\www\magento-1.1.2\magento\app\code\local\Reda\Custom\Block\Test.php

<?php

class Reda_Custom_Block_Test extends Mage_Core_Block_Abstract
{
  
protected function _toHtml()
  
{
    $html
="hello world";
     return 
$html;
  
}

?>

4- finaly in : CMS -> Manage Pages i choose the home page, and in it’s content i add :

{{block type="reda_custom/test" }}

what’s wrong ??!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
nikefido
Guru
 
Avatar
Total Posts:  481
Joined:  2008-07-11
New Haven, CT
 

i have copied and pasted this into my magento v 1.1.2 and it works perfectly.

Try turning your cache off in Admin > System > Cache Management (uncheck all or do “disable” from the drop down menu)

 
Magento Community Magento Community
Magento Community
Magento Community
 
rEda
Jr. Member
 
Avatar
Total Posts:  19
Joined:  2008-08-08
 

thank you very much nikefido it work perfectly now, without problem smile

THANK YOU

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top