|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
johnnie_d_1 Smarty Rookie
Joined: 22 Jul 2008 Posts: 15
|
Posted: Tue Jul 29, 2008 3:19 am Post subject: |
|
|
Thanks, Monte, for your reply. No insult to Smarty intended. Just
frustration coming out, after countless experiments and variations!
The problem, here, is that the SWF menubar in question is already
working in a number of my websites. For an example, go to:
"http://www.westerncardinal.com/wci_pages/WCI_SalesMain.php".
It's not a question of whether the SWF in question works - it does.
This is the exact, same menubar I'm attempting to run within my simple
Smarty application. The Smarty application, by the way, is the one from
Chapter 2 of the PACKT book, "Smarty, PHP Template Programming and
Applications", by Gheorghe, Hayder and Maia. Except for this menubar
issue, the application runs perfectly, and as designed.
Interestingly, if I substitute a reference to a simple JPEG image, in place
of the SWF reference, the image is visible. One sidenote, however. When
I reference the JPEG within my "images" subdirectory from the TPL file in
the "templates"subdirectory (both subdirectories are at the same level),
DreamWeaver CS3, as I would expect it to, makes the following reference: "../images/my_image.jpg". In order to make it work, though,
I have to manually change the reference to "images/my_image.jpg",
because it appears that the compiled TPL file is "promoted" up one level,
to the level ABOVE the "templates_c" subdirectory and, from there, it
expects to find my JPEG at "images/my_image.jpg", and not at
"../images/my_image.jpg".
Still stumped, still frustrated! Yikes! |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
Posted: Tue Jul 29, 2008 6:45 am Post subject: |
|
|
Just to be shure...
All references to javascript sources like
<script src="../Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
images, CSS files etc. are loaded by the browser and not by smarty. For that reasion the path specifications must be relative to the URL of the page and not relative to the template folder.
As Dreamweaver does not know that smarty will pick up the template from another location as the page root it does insert wrong references. |
|
Back to top |
|
johnnie_d_1 Smarty Rookie
Joined: 22 Jul 2008 Posts: 15
|
Posted: Tue Jul 29, 2008 1:16 pm Post subject: |
|
|
Eureka! The lost is found! It works!
Thinking about my last post, and the two replies from our trusty
administrators, I realized that I was forgetting to correct BOTH
required references for a SWF to work correctly. Through all my
testing, I had changed only the references to the SWF, itself, and
was not correcting the reference to "Scripts/AC_RunActiveContent.js".
In my TPL file, Dreamweaver CS3 was making the references to
"../images" and "../Scripts", and I was fixing only ONE of them, the
one to the SWF.
Thanks, everyone! My disease has been cured! |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Jul 29, 2008 1:43 pm Post subject: |
|
|
To make paths easy, use absolute paths from the doc root. Then no matter where you call them from, they should work. |
|
Back to top |
|
F2Mike Smarty Rookie
Joined: 18 Feb 2009 Posts: 7
|
Posted: Fri Jun 19, 2009 7:11 am Post subject: |
|
|
Quote: | Does anyone, I say ANYONE, have a concrete example of successfully
running a SWF from within a Smarty TPL file? |
Without being so patronising, i seriously second this motion - is there any example that exists anywhere in the world of somebody successfully embedding a SWF within a Smarty template. I've been searching for days and have found nothing. |
|
Back to top |
|
F2Mike Smarty Rookie
Joined: 18 Feb 2009 Posts: 7
|
Posted: Fri Jun 19, 2009 7:35 am Post subject: |
|
|
Ok, got it.
For anyone else out there who's looking for a working example, here's a tpl running a SWF generated by Flex:
Code: |
{literal}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../history/history.css" />
<script src="http://mike.f2.net.au/test/templates/reports/flex/AC_OETags.js" language="javascript"></script>
<script src="http://mike.f2.net.au/test/templates/reports/flex/history/history.js" language="javascript"></script>
<script language="JavaScript" type="text/javascript">
<!--
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Minor version of Flash required
var requiredRevision = 124;
// -->
</script>
{/literal}
{literal}
<script language="JavaScript" type="text/javascript">
<!--
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)
var hasProductInstall = DetectFlashVer(6, 0, 65);
// Version check based upon the values defined in globals
var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);
if ( hasProductInstall && !hasRequestedVersion ) {
// DO NOT MODIFY THE FOLLOWING FOUR LINES
// Location visited after installation is complete if installation is required
var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn";
var MMredirectURL = window.location;
document.title = document.title.slice(0, 47) + " - Flash Player Installation";
var MMdoctitle = document.title;
AC_FL_RunContent(
"src", "playerProductInstall",
"FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+"",
"width", "100%",
"height", "100%",
"align", "middle",
"id", "FlexPHP_Contacts",
"quality", "high",
"bgcolor", "#ffffff",
"name", "FlexPHP_Contacts",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
} else if (hasRequestedVersion) {
// if we've detected an acceptable version
// embed the Flash Content SWF when all tests are passed
AC_FL_RunContent(
"src", "http://mike.f2.net.au/test/templates/reports/flex/FlexPHP_Contacts",
"width", "100%",
"height", "100%",
"align", "middle",
"id", "FlexPHP_Contacts",
"quality", "high",
"bgcolor", "#ffffff",
"name", "FlexPHP_Contacts",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);
} else { // flash is too old or we can't detect the plugin
var alternateContent = 'Alternate HTML content should be placed here. '
+ 'This content requires the Adobe Flash Player. '
+ '<a href=http://www.adobe.com/go/getflash/>Get Flash</a>';
document.write(alternateContent); // insert non-flash content
}
// -->
</script>
{/literal}
<body>
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="FlexPHP_Contacts" width="100%" height="100%"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="../templates/reports/flex/FlexPHP_Contacts.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="../templates/reports/flex/FlexPHP_Contacts.swf" quality="high" bgcolor="#ffffff"
width="100%" height="100%" name="FlexPHP_Contacts" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
</noscript>
</body>
| [/code] |
|
Back to top |
|
jLix Smarty Regular
Joined: 01 Apr 2009 Posts: 59 Location: Lowlands, EU
|
Posted: Fri Jun 19, 2009 7:13 pm Post subject: |
|
|
johnnie_d_1 wrote: | The problem, here, is that the SWF menubar in question is already
working in a number of my websites. For an example, go to:
"http://www.westerncardinal.com/wci_pages/WCI_SalesMain.php". |
Please don't make your site navigatior or content dependant of JavaScript or Flash. Have you tried this page with JavaScript turned off. It's completely empty. _________________ http://jlix.net/extensions/smarty |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Jun 19, 2009 8:09 pm Post subject: |
|
|
F2Mike wrote: | Quote: | Does anyone, I say ANYONE, have a concrete example of successfully
running a SWF from within a Smarty TPL file? |
Without being so patronising, i seriously second this motion - is there any example that exists anywhere in the world of somebody successfully embedding a SWF within a Smarty template. I've been searching for days and have found nothing. |
Running SWF from Smarty is no different than running from plain HTML or PHP. You just have to be sure that the paths get adjusted appropriately. Smarty knows nothing about flash, it just creates text for the browser to consume. |
|
Back to top |
|
publicworksagency Smarty n00b
Joined: 18 Sep 2009 Posts: 1
|
Posted: Fri Sep 18, 2009 1:17 pm Post subject: Flash Insert |
|
|
Hello. This is my first post so I cant include URLs. Can someone help me figure this out please?
I saw this thread and I am having the same issue. I included the following and a blank area displays where my flash file should appear. Here is the information in the home.tpl :
{* BEGIN MIDDLE COLUMN *}
div style='float: left; width: 480px; padding: 0px 10px 0px 10px;'>
There is more information here but this system will not allow me URLs
{literal}pwapn.swf{/literal}
Thank you in advance for any help!
Regards,
Carlos |
|
Back to top |
|
dmsoft-wy Smarty n00b
Joined: 19 Sep 2009 Posts: 3
|
Posted: Sat Sep 19, 2009 8:50 pm Post subject: |
|
|
F2Mike wrote: | Ok, got it.
For anyone else out there who's looking for a working example, here's a tpl running a SWF generated by Flex:
[/code] |
Problem with the above is it links to javascript on another website...if you are going to post a script would be nice to post links to download the associated javascript.
|
|
Back to top |
|
novotai Smarty n00b
Joined: 15 Jan 2014 Posts: 1
|
Posted: Wed Jan 15, 2014 8:33 am Post subject: Problem with SWF height in the Smarty template |
|
|
Dear Sirs,
Please help me.
I have Smarty template and I need to integrate my flash swf in it.
My code in html (from Macromedia Flash :
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=koi8-r" />
<title>flash/flash5</title>
</head>
<body bgcolor="#000000">
<!--url's used in the movie-->
<!--text used in the movie-->
<!--
<p align="left"><font face="Verdana" size="10" color="#333333" letterSpacing="0.000000" kerning="0">Loading</font></p>
100%
-->
<!-- saved from url=(0013)about:internet -->
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="960" height="600" id="flash/flash5" align="top">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="flash.swf" /><param name="quality" value="high" /><param name="scale" value="exactfit" /><param name="salign" value="lt" /><param name="bgcolor" value="#000000" /><embed src="flash.swf" quality="high" scale="exactfit" salign="lt" bgcolor="#000000" width="960" height="600" name="flash/flash5" align="top" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</body>
</html>
So you can see that I need strict (fixed) dimensions: width="960" height="600".
I've done in my tpl file:
{include file='header.tpl' p="general"}
<noscript>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
id="FlexPHP_Contacts" width="960" height="600"
codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
<param name="movie" value="flash.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="allowScriptAccess" value="sameDomain" />
<embed src="flash.swf" quality="high" bgcolor="#ffffff"
width="960" height="600" name="FlexPHP_Contacts" align="middle"
play="true"
loop="false"
quality="high"
allowScriptAccess="sameDomain"
type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/go/getflashplayer">
</embed>
</object>
</noscript>
{include file='footer.tpl'}
But... In result height is width is correct (960px) but height is 340px always (not full).
I tried to use {literal} - same problem.
In any html file this code is ok always.
What to do?
Thanx in advance.
[/img] |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|