Magento: custom Module Access Data Through URL - magento-1.7

I have Created Magento adminhtml Module. it is working perfectly.
http://domain.com/cmg/data this is the module access url here there will be list of created fields in admin :
Title: Mama
subject: Foi
Message: BABA
what i need is when user click on TITLE MAMA that Redirect user to full view page where he can read the information in details.
how can i do that? i saw in blogs module there is link of the tites when user click on it that redirect to the other page.
i tried to access through url http://domain.com/cmd/data/id/8 getting 404 so what should i do?

i would suggest you to make another action in your controller like
public function detailsAction()
{
$this->loadLayout()->renderLayout();
}
Also create view file for details.phtml in your view
create block function
to get params id in block
$id = intval($this->getRequest()->getParam('id'));
fetch detail in function and return to view and display your detail in phtml file
hope this will sure your issue.

i got the answer.. I just created the below function in indexController file
public function infoAction() {
$this->loadLayout();
$this->getLayout()->getBlock('content')->append($this->
getLayout()->createBlock('finder/info') );
$this->renderLayout();
}
created Block File info.php
public function _prepareLayout() {
return parent::_prepareLayout();
}
in frontend layout file:
<finder_index_info>
<reference name="content">
<block type="core/template" name="finder" template="finder/info.phtml" />
</reference>
</finder_index_info>
i got front view.

Related

backpack for laravel getting link id

i need to export an specific record into pdf , so i created a inline button using addbuttomfrommodel function, now i need to pass the id of the specific record to the model where the route is created, how can it be done?
In model i have problem to pass the record ID in the href.so i can export only the specific record.
in model
public function getExportarButton() {
return "<a class='btn btn-primary' href='exportar_ficha'>Exportar A Documento</a>";
}
thanks ini advance
The entry object is available in your custom blade file as $entry

Prestashop module development - why is this template redirecting not working

On user-registration confirmation I want to show a simple popup. For the moment, in order to simplify I'm happy to show an "Hello World".
This is the template file, views/templates/hook/registrationConfirm.tpl
<div id="idname" class="block">
<h1 class="title_block">HelloWorld</h1>
</div>
In my custom module I have this hook (which I know is being triggered doing debug):
public function hookActionCustomerAccountAdd($params) {
return $this->display(__FILE__, 'registrationConfirm.tpl');
}
It doesn't show anything (I also tried inspect the source code of the rendered page, but I dind't find the "HelloWorld")
Hooks starting by "Action" react to an action but do not display anything, but those starting with "Display" do.
You should also react to the hook displayCustomerAccount
public function hookActionCustomerAccountAdd() {
$this->is_new_account = true;
}
public function hookDisplayCustomerAccount()
{
if ($this->is_new_account) {
return $this->display(__FILE__, 'registrationConfirm.tpl');
}
}
I tried the solution posted by #shagshag but for some reason it doesn't work for me. So I share my solution (it's not pretty, nor efficient I think, but it seem to work for me): in the hookActionCustomerAccountAdd I save on a custom table (newCustomersTmp) email and customer id, because these are the data I need after, in the display Hook. Then in the hookDisplayCustomerAccount I check if an user with the current email ($this->context->customer->email) already exists in my table: if so I retrieve the data, do the actions I need with them and delete the row in the table.

Symfony: Pass an object from another module to a form

I have a symfony project and I have one model, which for this example I will name Boat. From the Boat's showSuccess page, I would like to make a link to another model's form page. For this example we will call it Ticket. When they click on the link, I would like for the Boat object to be passed to the Ticket form because I have to display some of that specific Boat's fields (title, price, etc) on the Ticket form page (newSuccess.php).
I guess my question is, how do I pass an object (as a variable) to another model's "new" form page. I have looked everywhere and I can't seem to find an answer that works for me. Thank you!
UPDATE:
Here is some of the code I've tried:
Routing.yml
ticket_new_car:
url: /ticket/:category/:iditem
class: sfDoctrineRoute
options: { model: car, type: object }
param: { module: ticket, action: new }
requirements:
id: \d+
sf_method: [get]
Link on Car page
<a href="<?php echo url_for('ticket_new_car', $car)?>" > Test </a>
actions.class.php
public function executeNew(sfWebRequest $request)
{
$this->item = $this->getRoute()->getObject();
$this->forward404Unless($this->item);
$this->form = new TicketForm();
}
_form.php
<?php echo $item->getTitle() ?>
I'm getting "Undefined variable: item". I did everything in the tutorial except for the "slug" part because I'm not slugging my URLs. What could I be doing wrong?
Look at this page
http://www.symfony-project.org/jobeet/1_4/Doctrine/en/05#chapter_05_object_route_class
And scroll down to Object Route Class

How do I create a simple joomla plugin?

I'm having a real problem unstanding somthing thats probably very easy about creating and using joomla plugins.
Here is what I've done so far.
I've created a sample joomla plugin using the following two files inside of a folder and named them all the same.
I listed their contents below.
The plugin installs correctly through the admin panel
Then I enable it through plugin manager
ok. all set to go.
How do I use the plugin on an article once I've enabled the plugin?
ZIP FOLDER: MakePlugIn
FOLDER: MakePlugIn
MakePlugIn.php -
<?php
// No direct access allowed to this file
defined( '_JEXEC' ) or die( 'Restricted access' );
// Import Joomla! Plugin library file
jimport('joomla.plugin.plugin');
//The Content plugin MakePlugIn
class plgContentMakePlugIn extends JPlugin
{
function plgContentMakePlugIn (&$subject)
{
parent::__construct ($subject);
}
function onPrepareContent (&$article, &$params, $page=0)
{
print "I am a happy plugin";
}
}
?>
MakePlugIn.xml -
<?xml version="1.0" encoding="utf-8"?>
<install version="1.5" type="plugin" group="content">
<name>Make-Plug-In</name>
<author>Make-Plug-In</author>
<creationDate>03/15/2011</creationDate>
<copyright>Copyright (C) 2011 Holder. All rights reserved.</copyright>
<license>GNU General Public License</license>
<authorEmail>authoremail#website.com</authorEmail>
<authorUrl>www.authorwebsite.com</authorUrl>
<version>1.0</version>
<description>Make-Plug-In test</description>
<files>
<filename plugin="MakePlugIn">MakePlugIn.php</filename>
</files>
</install>
You should not be echoing or printing information in the plug-in.
The method is receiving article reference as a parameter, modify it and you are good. You can use var_dump to quickly identify proper object type and properties.
Here is Joomla tutorial on creating Content Plug-in.
Updated on 3/17/2011
This is in response to first comment.
In order to modify the article modify the value of referenced object &$article.
See example below:
function onPrepareContent( &$article, &$params, $limitstart )
{
// Include you file with ajax code
JHTML::_('script', 'ajax-file.js', 'media/path/to/js/dir/');
// Create ajax div
$ajaxDiv = '<div id="ajax-div"></div>';
// Modify article text by adding the div for ajax at the top
$article->text = $ajaxDiv . PHP_EOL . $article->text;
return true;
}
Adding external JS to the head of the document.

Zend Framework's Action helper doesn't use a ViewRenderer

I'm trying to execute an action from the view using the Action helper like but although the action is been executed the output isn't displayed.
Here's part of my .phtml file:
<div id="active-users">
<?php echo $this->action('active', 'Users') ?>
</div>
The action works like this:
class UsersController extends Zend_Controller_Action
{
function activeAction()
{
$model = new UsersModel();
$this->view->users = $model->getActiveUsers();
}
}
And there's another .phtml file that renders the list of users. The action works fine when called directly from /users/active but doesn't display anything when called from inside another .phtml file.
I've tracked the problem to the ViewRenderer not been available when called with action() helper... or at least not working as usual (automatically rendering the default .phtml file).
The content is displayed if I explicitly render the view inside the action but I need the ViewRender behaviour because I don't control the code of some of the actions I need to use.
Is there anyway to turn the ViewRenderer on while using the action() view helper? I'm open to replace the action() view helper if needed.
I forgot: I'm using PHP 5.2.8, Zend Framework 1.7.5, Apache 2.2 on Windows Vista.
Thanks
i think you should asign the active users from the controller or if you want you can use singleton on the models an use the directly in the views
$this->view = UsersModel::instance()->getActiveUsers();
Are you using _forward() o redirect on your action? Actions that result in a _forward() or redirect are considered invalid, and will return an empty string.
Update: I test it, and it works, try writing 'users' instead of 'Users' in the controllers param.
<div id="active-users">
<?php echo $this->action('active', 'users') ?>
</div>