[Solar-talk] Embeded php files

Sean Montague scene at themountainscene.com
Sat Apr 5 12:55:48 CDT 2008


Hi Antti,

I'm playing with this, an I can't seem to get it to work. What I have 
for directory structure is the standard:

"Vendor/App/Index.php"
"Vendor/App/Index/Layout/_content.php"
"Vendor/App/Index/View/index.php"

Where <?php echo $this->layout_content; ?> is in my _content.php and 
"Vendor/App/Index/View/index.php" is what gets written out. In FireFox I 
<?php include $this->template('_content.php'); ?> to get what I want. 
FireFox can read svg inline, but IE. Referring to your response, I tried:
<embed id="svg" width="100%" height="100%" src="<?php echo 
$this->action('App/Index.php') ?>" type="image/svg+xml" />,
<embed id="svg" width="100%" height="100%" src="<?php echo 
$this->action('App/Index/View/index.php') ?>" type="image/svg+xml" /> & 
just to be sure,
 <embed id="svg" width="100%" height="100%" src="<?php echo 
$this->action('App/Index/Layout/_content.php') ?>" type="image/svg+xml" />

None of these worked. I even put Vendor in the path. I looked up 
Solar_App_Bookmarks on the website, but it didn't help much. Were any of 
these three correct and maybe something else went wrong?  I have an 
alternative, but I want to avoid it because I would need to move the 
embedded doc into the docroot and out of Solar.

Thanks!
Sean

Antti Holvikari wrote:
> On Sat, Apr 5, 2008 at 12:01 AM, Sean Montague
> <scene at themountainscene.com> wrote:
>   
>> I have a situation that I hope can be solved. I've spent the last three days
>> moving an svg based app I'm writing into SolarPHP, which has made life
>> easier. Problem is, due to something funky IE8 beta did to my computer, my
>> IE7 cannot view php generated svg files. No explanation why, just that I
>> probably need to reformat my disk and do a clean install, which I don't have
>> time for right now. So I finally got around to testing from my laptop in
>> IE7. One thing I did not consider before moving all my stuff to Solar is
>> that in IE I must use the adobe svg viewer, which requires that I embed the
>> svg file as <embed id="svg" width="100%" height="100%" src="_content.php"
>> type="image/svg+xml" />, where _content.php is the main svg doc. My
>> _index.php looks like:
>>
>>  <?php if($browser == 'moz'):?>
>>    <?include $this->template('_content.php');?>
>>  <?else:?>
>>    <embed id="svg" width="100%" height="100%" src="_content.php"
>> type="image/svg+xml" />
>>  <?endif;?>
>>
>>  They both reference the same file, but $this loses context in the embeded
>> file. Ultimately, we'll be using activeX in the app, which means IE will be
>> the only option, meaning I must be able to embed the file. Is there a way to
>> gain access to all the Solar variables? Thanks!
>>     
>
> You can do this:
>
> 	<embed id="svg" width="100%" height="100%" src="<?php echo
> $this->action('app/controller/action.svg') ?>" type="image/svg+xml" />
>
> Adding the `svg` to the href makes Solar to look for action.svg.php
> template for that action. Then in that template you can generate the
> output and set correct headers for the content.
>
> Take a look at Solar_App_Bookmarks and see how RSS is served.
>
>   


More information about the Solar-talk mailing list