Vbscript classic asp custom classes - html

Is it possible to create customer classes in classic asp (vbscript) like you can in asp.net with c#?

Apparently it is. And here is an ASP 101 article on using them with ASP.

Yes it is possible. You can use a class file . All you need to do is write your function on a file. Suppose the name of your file is func.asp . Write all your functions or procedures in the file "func.asp" and use it <!-- #include file ="subs_functions.asp" --> Write the above line in all the pages where you want to use the functions written on "func.asp page.
If your class file is in the server(root folder) the code will be something like
<!-- #include virtual ="\YourFolderNames\myfilename.asp" -->

Related

How to parse a Razor template with partials from a custom folder?

I have two cshtml-files in the same subfolder of Views. One of the templates is meant to include the other template. I tried to accomplish that as follows:
Main template:
<html>
<head></head>
<body>
#Html.Partial("~/Views/Pdfs/Header");
</body>
</html>
The error I get is
Unable to compile template. The name 'Html' does not exist in current context.
What am I supposed to do additionally?
As commented by Erik there is no Html in RazorEngine (see the linked answer), however you can use #Include("mytemplate") instead.
If you want to be compatible with the #Html.Partial() syntax for some reason you can extend the RazorEngine syntax like this.
Basically what you want to do is provide your own class inheriting from TemplateBase<T> (or ITemplate to be exact) and then set it either via configuration or the #Inherit MyBaseClass<MyModel> syntax. In this case you could just call the Include method from your Partial method within the Html helper class.
Been annoyed by this for a long time. Wrote all the infrastructure classes to just get this working like you'd expect in MVC, without all the MVC burden:
var razor = RazorHelper.O;
var html = razor.RenderFromMvc(#"Views\RazorEngine\TestEmail.cshtml", vm);
https://github.com/b9chris/RazorEngineComplete

Using angular .tpl.html files to build a static .html file

I'm not sure if I'm going about this the right way, however this is what I need to do. I have common .tpl.html files that I want to use both for an angular template and a template to generate a static .html file. What I want is a system (grunt-related) that will take the junk in .tpl.html and insert it in a outer .html file and create a static .html file.
For example, say I have:
stuff.tpl.html
<div> I want this stuff in my overall template </div>
stuff2.tpl.html
<div> I want this stuff in my overall template to create another html</div>
outer.html
<head>
stuff
</head>
<body>
{{insert}}
</body>
where I can make stuff.html (or stuff2.html) by inserting stuff.tpl.html (or stuff2.tpl.html) into outer.html.
I know how to do the angular side, just not the static side.
If I'm not mistaken you need to concatenate multiple static files in to a one single file.
You can use grunt-contrib-concat to do the job. See the below link grunt-contrib-concat
If you need to implement the template with angularJs, you can use grunt-html2js which will convert your static html to angular template. Then you can use grunt-contrib-concat to concat all the angular template and create one js which you can add to your index.html subequently.
Hope this might help you.

html template without using php or rails ect

I am looking for a way to code html templates without using any "backend" languages like php or ruby/rails.
using JS could work but i have issues with my current javascript when i add nodes after the DOM is loaded.
the solution that would be ideal is if there is a preprocessor of some kind that i can compile into finished html.. something similar to SCSS but for html
just so i'm clear and i have enough content for stackoverflow..
i want partial.folders content to compile into index.html
partial.folder
menu.html
root.html
footer.html
|
|
V
index.html
Depends on "when" you want to parse the templates.
1) At runtime: you could try to use https://github.com/janl/mustache.js - javascript Logic-less templates
2) At build time: I would suggest using nodejs+Grunt (http://gruntjs.com/) + grunt-preprocess (grunt plugin)
I found an answer to my own question. a program called codekit worked exactly how i wanted it to. thanks for the help! http://incident57.com/codekit/

Using SSI in HTMLs imported using c:import in jsps

I have a bunch of htmls in the webserver context (outside the application context) in the htdocs area. These htmls use SSI to call other htmls.
Here's the problem:
When I use c:import to call the main html into the jsp, the secondary htmls inside the main html don't render / are not processed.
Is there a way to get the main html to "compile" and then return to the jsp?
JSP codes:
<c:import url="<%=/folder/Header.html%>"
HTML server side logic that needs to be processed:
<!--#include virtual="/abc/xyz.html" -->
<!--#if expr='"$Category" = "someCategory"' -->
<!--#echo var="pageTitle" -->
The prototypes were given as all htmls, so everything was in the web context and all files worked fine. The issue is moving the top layer to JSP and keeping the rest of the layers as HTML. (Its a requirement)
Any solutions /thoughts/ ideas would be welcome! Thanks for your asssistance!
Wave
EDIT: Ok, I'm getting the Header.html in an iFrame because that will initiate a new HTTP request (and thus have access to the SSI logic).
<iframe id="testSSI" src ="http://somesite.com/subfolder/testssi_1.html?pageTitle=Applications" frameborder="0" width="800px" height="300"></iframe>
The parameters are sent in the URL and I've managed to extract the control parameters using js.
My query has reduced to this:
How can I access this js value "Applications" in the SSI logic? Is it possible to set is as an environment variable? That could be pulled by the SSI logic.. I realise that the Js will run after the SSI is done, but hoping someone here would be able to help.
Thanks!
Thanks, got it done.
I accessed the parameter in SSI by using the QUERY_STRING environment variable.
Example of html call:
http://somesite.com/subfolder/testssi_1.html?Applications
Example of how i retrieved the value:
<!--#set var="pageTitle" value="$QUERY_STRING" -->
<!--#if expr=" ${pageTitle} = Program " -->
do something
<!--#else -->
do something else
<!--#endif -->
The objective here:
We use a JAVA framework. But Marketing wanted content to be editable by them in a separate process.This way, they can change the content frequently with out the intervention on the jsp / java team. (Eg. change header look and feel, add new links, etc)
Hope this helps someone out later. :)
Wave
Edit: In the example above -> "Applications" will take the logic to the else section..
In addition, to send name value pairs:
http://somesite.com/subfolder/testssi_1.html?name=Applications&app=Demo
you can reference them as:
<!--#if expr=" ${QUERY_STRING} = /name=Applications/ " -->
AND
<!--#if expr=" ${QUERY_STRING} = /app=Demo/ " -->

how to change the flash builder generate HTML to call function in actionscript?

I have an actionscript project, and I have provided the function that I want it to be called from HTML(the flash builder generated html file).
ExternalInterface.addCallback("getURL", getURL);
This is the code in actionscript, how can I modify the flash builder generated html file so that it can call getURL()?
Just add your function between <script> tags in index.template.html file that is located in html-template folder of your project.
alternatively, you don't have to use the html template, it's totally possible for you to create your own html and implement your own settings. Just go to the Project properties and uncheck the "Generate HTML..." checkbox.
as for your javascript function , you could have it in an external file and access it like this. it'd be easier to maintain, if the need to add more functions arises
<script type="text/javascript" src="external.js"></script>