Hosting playn application on Google sites - playn

I am trying to host a client-only (no network, no persistence) PlayN game on Google Sites. Anyone know an easy way to do this?
My first attempt was to upload the game.nocache.js file to a "file cabinet" and load it from a script tag in a page html, but Sites cuts out script tags.
My next attempt was to create a simple gadget that loaded the script from the file cabinet, since I've used gadgets to get around the script-embedding issue before. The gadget looks like this:
<Module>
<ModulePrefs title="PlayN Gadget" width="800" height="600" />
<Content type="html">
<![CDATA[
<div id='playn-root'></div>
<script src="files/game.nocache.js"></script>
]]>
</Content>
</Module>
(Where 'files' is the name of the file cabinet page.) However, this gives an html validation error upon trying to include the module, an unclosed META tag somewhere deep in the js file.
Anyone have success with this?

Related

Demandware external CSS file

I have very little demandaware knowledge as my boss who was supposed to train me this year ended up quitting so now I am in the dark. I am attending workshops later this year but until then Google and stackover is my teacher. I am editing a content asset and at the top of the code there is a link to an external CSS sheet. All of the work I have done in the content asset pages, the CSS and html have all been on one page and I have no idea how to get to that external CSS sheet. Any help would be greatly appreciated. This is what the link looks like
<link href="test/fitting/css/test-fitting.css?$staticlink$" rel="stylesheet" type="text/css" />
That is referencing a file in the content library. You can browse those files by going to the Import/Export module within the Content section of Business Manager. Within the Import/Export Mosule is a link to manage content images. Click that. This should open a window that allows you to browse, upload, and delete the files. You can simply upload a file with the same name in the same location to replace the existing file.

make jboss editor read external bootstrap 3 css style and auto complete

I asked a similar question here:
JBoss tools for JSP: Make content assist work for Bootstrap "class" as in HTML Editor
In which I realized that JBoss web page editor is able to read CSS styles and render them in the preview tab, and auto-complete with correct suggestions, only if the .css file is included explicitly in the <head> part of the webpage you are editing, like this:
<link rel="stylesheet" href="mystyle.css">
But, in another project I am working at, we are using Tiles, and every single web page we create, inherits general-layout in the tiles-definition.xml like this:
<definition name="somepage" extends="generalLayout">
<put-attribute name="body" value="/WEB-INF/...../somepage.tile.jsp"/>
<put-attribute name="script" value="/WEB-INF...../somepage.script.tile.jsp"/>
</definition>
<link> part is included in the general-layout page and not in every web page, so the JBoss web page editor cannot render them when we code, and no auto-completion.
Is there any way to config the editor to force it read some .css files in the project, so we can see the effect on-the-fly and to have the auto-completion?
Thanks.

Why can't the Google sites HTML box load a CSS script linked with URL?

I'm mostly certain that I set up my HTML script correctly, and made sure that the needed CSS file would be hosted in a shared folder on Google Drive, correctly cited, etc.
However, when I copy my HTML code into the box, and save it all, the editor always throes this error: 1+12 - 125: failed to load external url navigator.css
While I would think that linking the CSS file to the HTML code regularly, as I posted below, I only see so many issues coming up with CSS linking, and even more worrying, is that the Google support documentation (here) says that an HTML box can't 'refer' to external code, including what I believe may be such a CSS file.
<link href="http://[mixed aplhanumeric subdomain].googledrive.com/host/[shared folder's 'mixed' address]/navigator.css" rel="stylesheet" type="text/css">
Given that, would anyone know a simple workaround to linking the HTML to the CSS code in the Google sites HTML box?
The documentation shows an example with the CSS in <script> tags. I don't perceive any indication that including CSS from an external file is allowed. The documentation explicitly states that <link> tags are not allowed. The reason why Google Sites can't load CSS in a linked file, is because link tags are not allowed. You're only choice is to include the CSS in <style> tags.
There is an alternative though. You can create an Apps Script HTML Service application with separate HTML and CSS files, and then put the Apps Script application into your Google Site.
Apps Script HTML Service
If you want to use Css on Google SItes , you can use directly. not to use link.

How can I use flash files in my SDL Tridion page?

My page is showing regular component presentations very well.
I have a flash/video file in my local machine and i want to upload this file on my page.
How can I achieve this?
I have this code snippet for rendering components on my page:
<!-- TemplateBeginRepeat name="Components" -->
<!-- TemplateBeginIf cond="ComponentTemplate == 'HomePageCT'" -->
##RenderComponentPresentation()##
<!-- TemplateEndIf -->
<!-- TemplateEndRepeat -->
Please provide all details related to flash files and video files.
Placing a Flash file on a page follows exactly the same process as placing any image in the output of your templates. The steps are outlined below:
Create a Multimedia Schema which allows the Flash multimedia type (e.g. Flash Video Schema)
Upload your Flash file using your new Schema
Create a Component Template to render the HTML you want to use to display the Flash file, and actually publish the binary itself. (e.g. Display Flash CT)
Create a page template (you seem to have done this part) which renders the Page, and renders the Components on the page using ##RenderComponentPresentation()##
Create a Page, and place your Flash file on it using the Display Flash CT
Publish the Page
Without details of the output you want to produce, it is hard to provide the sample Dreamweaver Template Building Block code for the DisplayFlash CT, but it might look something like this:
<embed src="##Component.Id##" allowFullScreen="true" width="540"
height="438" bgcolor="#000000" type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed>
Make sure you use the Default Finish Actions TBB after this in your Component Template so that the src link is processed and the binary is published.
There is nothing special about Flash files with Tridion. They can be treated just like any other Multimedia Component. You can upload them into the CME (or by using Webdav) and thus you will have a Multimedia Component. Make sure of course, that you Multimedia Schema allows the Flash (and extension) as Multimedia Type.
Regarding how you put the Flash file on the Page - again just like a normal Multimedia Component. In your CT you have to generate the output that will make use of your Flash file URL somewhere. You will have to publish your Flash MMC in order to get its URL. You can use Engine.AddBinary or RenderedItem.AddBinary methods for that, or use the Publish Binaries in Package Default TBB, if your MMC is in the package. Then you can simply refer to your Flash URL as package item. Have a look at this URLs for some inspiration: http://yatb.mitza.net/2012/03/publishing-images-as-variants.html (your case doesn't have to be that complex) and http://yatb.mitza.net/2012/04/referencing-image-variants-from.html.
There are several approaches to rendering Multimedia with a Tridion-managed page.
Multimedia components can be:
Part of a component presentation, added to a page with a template selected
As a linked-to multimedia component within a "container" component, which is added to a page
In a rich text format (RTF) area within another component
You could also just publish binaries with dynamic component templates and handle the markup and links outside of Tridion. Get creative with the above basic scenarios depending on the markup and/or metadata you need.
Chris addresses #1 and Mihai explains schema setup and .AddBinary. The second option would be similar, except you'd have to get the referenced ID rather than the component on the page. The third option requires you to parse multimedia within RTF which depends on your templating language and multimedia type.
I've seen XSLT (<xsl:template match="">), grep, and various .replace options to parse specific markup such as Flash videos.

Embedding a spark variable to make up a string

Hi new to spark so this should be simple.
I'm converting an old webfoms page to mvc using spark.
I want to use the Base.Application to make up the src of a url
original markup
<img alt="" src="<%= Base.ApplicationPath %>images/screenshots/myImage.jpg" />
I've tried this in spark
<img alt= src=${ Base.ApplicationPath }+">images/screenshots/myImage.jpg" />
but no joy.
How do i do this in spark?
Not sure if you're aware of this, but Spark has a DefaultResourcePathManager that will automatically locate the Site Root if you prefix the resource with a tilde, so this should work just fine, and looks neater.
<img alt="" src="~/images/screenshots/myImage.jpg" />
There's an added bonus to using this technique as well....hold on to your shorts! Without changing your view, simply by making sure you use the tilde convention, you can dynamically redirect requests for your static resources to a content delivery network (CDN) or a completely different location - even an embedded resource inside a Spark Module .dll you compile for dll drop in deployment.
For example, to hook it up to a CDN, all you'll need to do is add the following kind of thing to your Spark Settings:
<resources>
<add match="/content/images" location="http://mycdn.com/youraccount/images"/>
<add match="/content/css" location="http://mycdn.com/youraccount/css"/>
<add match="/content/js" location="http://mycdn.com/youraccount/js"/>
</resources>
...and from then on those resources will be fetched from the new location instead. This is great for scenario testing locally, and the deploying to the cloud later.
Slight tweak of the syntax has sorted it.
<img alt="" src="${Base.ApplicationPath}images/screenshots/myImage.jpg" />

Resources