我在控制器中创建了一个带有2个功能的自定义模块,一个用于索引页面,另一个用于成功页面。我能够访问索引页面但是当我在url中输入成功页面时,它显示404找到。我不知道我在哪里犯了错误。
我的模块名称是instagram ..我的控制器代码:
app/code/local/Blazedream/Instagram/controllers/IndexController.php
<?php
class Blazedream_Instagram_IndexController extends Mage_Core_Controller_Front_Action
{
public function indexAction() {
$this->loadLayout();
$this->getLayout()->getBlock('login.instagram');
//print_r($this->getLayout()->getBlock('footer.topvendors'));die;
$this->renderLayout();
}
public function successAction() {
echo "hello hello"; die;
$this->loadLayout();
$this->getLayout()->getBlock('login.success');
//print_r($this->getLayout()->getBlock('footer.topvendors'));die;
$this->renderLayout();
}
}
我的config.xml文件:
app/code/local/Blazedream/Instagram/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Blazedream_Instagram>
<version>1.6.2.0.4</version>
</Blazedream_Instagram>
</modules>
<frontend>
<routers>
<instagram>
<use>standard</use>
<args>
<module>Blazedream_Instagram</module>
<frontName>instagram</frontName>
</args>
</instagram>
</routers>
<layout>
<updates>
<instagram>
<file>instagram.xml</file>
</instagram>
</updates>
</layout>
</frontend>
<global>
<blocks>
<instagram>
<class>Blazedream_Instagram_Block</class>
</instagram>
</blocks>
</global>
</config>
我的登录栏文件:
app/code/local/Blazedream/Instagram/Block/Loginblock.php
<?php
class Blazedream_Instagram_Block_Loginblock extends Mage_Core_Block_Template {
public function loginblock() {
$instagram = new Blazedream_Instagram_Block_Instagramclassblock(array(
'apiKey' => 'cb513b66892b45bda10682dad0af12ff',
'apiSecret' => 'e17241be433642f1af478fe06677a8f4',
'apiCallback' => 'http://192.168.1.188/projects/shopu_v2/trunk/shopu/index.php/success' // Callback URL
));
return $instagram;
}
}
我的成功阻止文件:
app/code/local/Blazedream/Instagram/Block/Loginblock/Success.php
<?php
class Blazedream_Instagram_Block_Loginblock_Success extends Mage_Core_Block_Template {
public function successblock() {
$success = "success";
return $success;
}
}
我的布局文件:
app/design/frontend/mtquartz03/default/layout/instagram.xml
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="content">
</reference>
</default>
<instagram_index_index>
<reference name="content">
<block type="instagram/loginblock" name="login.instagram" template="instagramlogin/instagram.phtml"></block>
</reference>
</instagram_index_index>
<instagram_index_success>
<reference name="content">
<block type="instagram/loginblock_success" name="login.success" template="instagramlogin/success.phtml"></block>
</reference>
</instagram_index_success>
</layout>
然后我也创建了我的视图文件......
我的网址访问控制器中的索引功能:
http://192.168.1.188/projects/shopu_v2/trunk/shopu/index.php/instagram
我的网址访问控制器中的成功功能:
http://192.168.1.188/projects/shopu_v2/trunk/shopu/index.php/instagram/success
任何人都可以帮助我指导我犯错的地方。 提前谢谢。