[Solar-talk] Embeded php files
Antti Holvikari
anttih at gmail.com
Sat Apr 5 10:35:11 CDT 2008
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.
--
Antti Holvikari <http://anttih.com>
More information about the Solar-talk
mailing list