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

Page 2 of 2
To create a new page
 
aimos
Jr. Member
 
Total Posts:  18
Joined:  2007-12-28
 

Seems a little bit more complicated than *I* thought.

I tried this example BUT with my own namespace. So Everything I did was in other folders, I assumed that the framework would firgure that out himself.

Boots insetad of Mage

/app/code/local/Boots/Sampleorder
/design/frontend/boots/default/layout
/design/frontend/boots/default/template

I copied the default frontend stuff and just renamed “default” to “boots”

I’m not sure why I can’t see a thing, I’ll now try everything with “Mage” just to get started.

In your one note about the main.xml ... well not even the default/frontend layout has a main.xml and I think we talk here about the frontend.

I checked also the Admin Menu about the Modules. There is no “Boots_xx” Module shown to enable or disable.

Any suggestions?

 
Magento Community Magento Community
Magento Community
Magento Community
 
kohril
Member
 
Total Posts:  44
Joined:  2007-12-23
Lille, northernFrance
 

I’d like to create an index page for my module, which url will be : http://localhost/magento/sampleorder

I created a controller :

class Mage_Sampleorder_IndexController extends Mage_Core_Controller_Front_Action
{
  
public function indexAction()
  
{
    $this
->loadLayout();
    
$this->renderLayout();
  
}
}

I created a block in layout.xml :

<sampleorder_index>
<!-- 
insert tsample blocks into middle column (content) -->
    <
reference name="content">
<!-- 
create generic template block -->
      <
block type="core/template" name="sampleorder.tsample.generic" template="sampleorder/tsample.phtml">
        <
action method="setSomeValue"><value>this value is assigned from layout</value></action>
      </
block>
 
<!-- 
create tsample block -->
      <
block type="sampleorder/tsample" name="sampleorder.tsample.custom" template="sampleorder/tsample.phtml"/>
    </
reference>
  </
sampleorder_index>

But apparently, the layout file in not taken into account. I have an empty page without any message. If I add echo"hello world” in IndexController, it is properly displayed, so the problem comes from the layout file.

Is there something special we should add to display an index page in the layout file ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

Please use <sampleorder_index_index> as the handler

 
Magento Community Magento Community
Magento Community
Magento Community
 
kohril
Member
 
Total Posts:  44
Joined:  2007-12-23
Lille, northernFrance
 

Thanks Moshe ! it works wink

 
Magento Community Magento Community
Magento Community
Magento Community
 
kaancho
Jr. Member
 
Total Posts:  24
Joined:  2008-04-16
 

I am just trying to follow the steps described in this thread....but I am getting stumped on “404 Not Found” error.

Here’s my layout so far:

in app/etc/modules/MyNameSpace_All.xml

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

in app/code/local/MyNameSpace/Sampleorder/etc/config.xml

<?xml version="1.0"?>
<config>
    <global>
        <
blocks>
            <!-- declare 
sampleorder block group -->
            <
sampleorder>
                <class>
MyNameSpace_Sampleorder_Block</class>
            </
sampleorder>
        </
blocks>
    </global>    
    <
frontend>
        <
routers>
            <!-- declare 
a router for urls starting with /sampleorder -->
            <
mynamespace_sampleorder>
                <use>
standard</use>
                <
args>
                    <
module>MyNameSpace_Sampleorder</module>
                    <
frontName>sampleorder</frontName>
                </
args>
            </
mynamespace_sampleorder>
        </
routers>
        
        <
layout>
            <
updates>
                <!-- declare 
a file that will supply layout updates for your controllers -->
                <
sampleorder>
                    <
file>sampleorder.xml</file>
                </
sampleorder>
            </
updates>
        </
layout>
    </
frontend>
</
config>

The file app/code/local/MyNameSpace/Sampleorder/controllers/TsampleController.php,

<?php

class MyNameSpace_Sampleorder_TsampleController extends Mage_Core_Controller_Front_Action
{
  
public function indexAction()
  
{
    $this
->loadLayout();
    
$this->renderLayout();
  
}
}

/Block/Tsample.php

<?php

class MyNameSpace_Sampleorder_Block_Tsample extends Mage_Core_Block_Template
{
  
public function getSomeValue()
  
{
    
return 'this value is taken from custom block';
  
}
}

and app/design/frontend/default/default/layout/sampleorder.xml

p><?=$this->__("Translated label for some value: %s"$this->getSomeValue())?></p>

When I goto:

http://localhost/sampleorder/tsample or http://localhost/sampleorder I get “404 Not Found “

Ayny input is appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
kaancho
Jr. Member
 
Total Posts:  24
Joined:  2008-04-16
 

any help?
I cannot get this to work.

 
Magento Community Magento Community
Magento Community
Magento Community
 
tman_f
Sr. Member
 
Total Posts:  85
Joined:  2008-02-12
 

Add this to app/etc/modules/Mage_All.xml :

<Mage_SampleOrder>
<codePool>local</codePool>
<active>true</active>
</Mage_SampleOrder>

Also, Im not sure what you are meaning when you say MyNameSpace, but it should be Mage.

Good Luck

 
Magento Community Magento Community
Magento Community
Magento Community
 
kaancho
Jr. Member
 
Total Posts:  24
Joined:  2008-04-16
 

thanks for the reply. however after all the modifications i still get the page not found error:

this is what i have done so far

added to the modules/Mage_All.xml file:

<Mage_Sampleorder>
                <
active>true</active>
                <
codePool>core</codePool>
        </
Mage_Sampleorder>

Also, I added the xml to Add this to app/etc/modules/Mage_All.xml....but I still see page not found error.

There was no Mage folder in /app/code/local so I created one and entered all the files there and made the change from “MyNameSpace” to “Mage” to reflect that.

any idea what i might be doing wrong?

 
Magento Community Magento Community
Magento Community
Magento Community
 
kaancho
Jr. Member
 
Total Posts:  24
Joined:  2008-04-16
 

Just out of curiosity how can I even start to debug this.....I am not sure in one or all the xml files i created for my module are being read at all.
Any idea?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tweakmag
Guru
 
Avatar
Total Posts:  307
Joined:  2007-08-31
London, UK
 

This won’t help your error - but for your info - you shouldn’t add to Mage_All.xml, but rather you should create Mage_Sampleorder.xml and put the xml in there - this way you don’t have to worry about core updates.

Cheers
Adam smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
R.Verheij
Jr. Member
 
Avatar
Total Posts:  16
Joined:  2008-04-08
Amsterdam, Netherlands
 

Hi,

I followed the 6 steps Moshe gave, and followed the updates that followed in this thread.
I couldn’t get it to work, decided to leave this for now and get on with other stuff, so I deleted all the files I created ( I’m quite sure I didn’t change any existing files ), and now both frontend and backend turn blank / white with no output at all....

It worked fine just before… any ideas what causes this or even better, how to solve it? ( chache is off btw )

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tweakmag
Guru
 
Avatar
Total Posts:  307
Joined:  2007-08-31
London, UK
 

Did you remove the entry in the xml (Mage_All.xml)?

 
Magento Community Magento Community
Magento Community
Magento Community
 
R.Verheij
Jr. Member
 
Avatar
Total Posts:  16
Joined:  2008-04-08
Amsterdam, Netherlands
 

Yes I did. double checked just now.
And a global search for ‘sampleorder’ gives no results.

EDIT: never mind, my own fault. By editing local.xml as described earlier this thread I accidentally uploaded and old version of local.xml with old database settings. I learned: No database connection = everthing goes blank.

Tnx anyway

 
Magento Community Magento Community
Magento Community
Magento Community
 
kaancho
Jr. Member
 
Total Posts:  24
Joined:  2008-04-16
 

K, did move the contents

<Mage_Sampleorder>
                        <
codePool>local</codePool>
                        <
active>true</active>
                </
Mage_Sampleorder>

to a new file named Mage_Sampleorder.xml.

Any input regarding how i might be able to see if any xml or.phtml files are being read or found at all.....any way to debug?

also do i have to refresh my configuration cache? I havent done that or know how to do that.

UPDATE:

Thanks for all the help. The configuration cache needed to be refreshed. Its working now.
Thanks again for all the input.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 2