I’ve taken on a symfony project that someone else built. As such I don’t know that much about how it works really. I’ve been doing various changes over the last 6 months, so have a vague idea… but this problem has stumped me.
I’m optimistically hoping that you guys will be able to help, just by going off of the filenames/directory structure. So I’ll try to keep it simple.
Something I know inside…
/apps/frontend/modules/search/actions.class.php
Needs to be visible to…
/apps/frontend/modules/contact/templates/_minicontact.php
These two files are output into this template:
/apps/frontend/templates/pageDetails.php
with the following two lines of code:
<?php echo $sf_content ?>
and...
<?php include_component('contact','minicontact'); ?>
I’ve tried setting $this->myvar in the first file, and checking both $this->myVar and $myVar in the second file, and I’ve had no luck.
BODGING IS FINE. I just want the quickest and simplest way to achieve this. The client will be getting a completely new site in the next few months, so there’s no need to do this “nicely”. Just give me the quick and dirty! 🙂
I’m sure the answer is very simple… I’ve spent quite a while with get_defined_vars trying to figure out where I need to be putting it, but to no avail.
THANK YOU!
edit: Symfony v1.2, though I doubt the version makes any difference to the question.
UPDATE:
I just noticed your path for pageDetails. It msut be an alternate layout. In that case you need pass the variable up to the layout. Typically this would be done with a slot from withing the view being rendered. But you havent provided enough info to know if this is going to work because you may need this value passed up from multiple views from within multiple modules.
Therefore the easiest solution is probably going to be to jsut duplicate whatever logic produces the value in the minicontact component.
Im confused as to why
$sf_contentwould be echoed inpageDetails.phpwhich should be a view for a given module. Normally$sf_contentwould only be seenlayout.php.Any how you pass parameter to a component or a partial like so:
ofcourse that assumes that the value you want to pass to
minicontactis already present in thepageDetails.php. If its not then you would need to add it to the view as a variable in your actions class – for examplethen in
pageDetails.php: