I'm working on a code generation with T4 template. I'm generating multiple .cs files by one template and i need to write correct namespace for this files. Namespace depends on the template location.
How can i get the template namespace for generated .cs files?
I know the only one way to do this - explicit setted property "Custom Tool Namespace" for the template and then get this property via EnvDTE assembly. But this way is not ok for me, cause i need a locate a lot of copies this template for generate files in different propjects and i want to get namespace dynamically by the template location.
Can anyone help me?
Can you use EnvDTE's FileCodeModel to get the relative path of your template; and then use that to build your outputted namespaces?
You might want to browse through this post: http://t4-editor.tangible-engineering.com/blog/walking-the-visual-studio-code-model-with-t4-template.html
Related
I can upload an image, then on its File page I can transclude a Cargo-enabled template that stores some metadata about that image, and later query that template's table in order to create a gallery. However, the manual addition of the template to the File page is tedious and error-prone (e.g. incorrectly naming other pages in various template fields). Is there an extension, perhaps something like Page Forms, that would allow me to simplify this process, so that I could upload an image and populate its metadata on a single page? Is there any simpler workflow in base MediaWiki to achieve this result?
I'm not familiar with Page Form based solution,
What i've done in a similar case (added a templates to 3 sets of ~1k pages) is to use pywikibot (its a library that allows you to do some automated processes in your mediawiki, that an external tool).
The solution is depend on your template, Does your template receive any arguments?
Template without arguments, its enough just to add "{{My_Template}}" to the page, You can achieve this with pywikibot's add text.py script
Template with arguments, that more complicated, In this case i would write a simple python script that will use pywikibot and add the required text (There are several options here)
2.1. Add of relevant files to category with category script, Then in your script iterate over all pages in the category using:
"from pywikibot import pagegenerators" and
"pagegenerators.CategorizedPageGenerator"
2.2. Using:
"pagegenerators.SearchPageGenerator" and passing a namespace + filtering the files you want by predefine knowledge.
BTW, if you are uploading many files, you can use BatchUpload
I'm new to Joomla.
I'm having a small doubt coming to creating Joomla templates. In the file structure provided by joomla I can see only index.php file. My doubt is can we create a Joomla template using HTML also. so that in the file structure it reads index.html.
Thanks in Advance and Merry Christmas.
It is important here to distinguish between "can" and "should" here. I believe you "can" make a template in an html file without losing all of the Joomla functionality because Joomla places modules using tags like <jdoc:include type="modules" name="user4" /> which it will parse. I'm not positive, but fairly certain that the template does require a php to bootstrap it, but you could just have the php file include the html you want to use. The major drawback is that you will be losing all of the php helper methods that Joomla makes available for you, like JURI::base() for dealing with paths for your scripts/css, etc.
You definitely should take advantage of Joomla's capabilities with php, so use the php file. If you want to include some html files into that document, that's just fine.
I don't think you can do that. The index.php file you are referring to is the root index file, while each template has its own index.php file inside their folder inside templates folder. For example templates/beez3/index.php Joomla includes the index.php file of the chosen template during it's execution cycle. Failing to find such a file it will fall back to a preinstalled template throwing an error: The template for this display is not available. Also the frontend requests start by loading the root index.php file first and then proceed to other calls and <jdoc:include type="component" /> won't load anything as it won't have any framework loaded or any joomla functionality at all. Finally no extension will work since they all require the _JEXEC constant to be defined as it's being defined in the root index.php file:
/**
* Constant that is checked in included files to prevent direct access.
* define() is used in the installation folder rather than "const" to not error for PHP 5.2 and lower
*/
define('_JEXEC', 1);
It must be written in php and you can certainly keep your theme that you created within the template folder, as for keeping .html you can always use htaccess to serve whichever extension you want.
I recently upgraded to phpdoc 2 and want to create a solution for outputting my api to wiki markup, instead of html or pdf.
In /usr/share/php5/data/PhpDocumentor/Converters, I see the CHM, HTML, PDF, and XML folders. Is it possible to create a WIKI folder and put the configuration files in there?
You can indeed store your custom output converter there, but you'll also need to write a custom extended Converter class -- http://manual.phpdoc.org/HTMLSmartyConverter/HandS/li_Converters.html
Hi i am using struts2 and hibernate in my project. I need to use a namespace for my admin section so that i have used the namepace as companyAdmin and i have created a folder inside the web folder named companyAdmin and it is worked fine. But when i delete the folder companyAdmin from the web folder the struts show an error error message when trying to access the namespace. Is there a folder with name as namespace name is a must in struts2 for using the namespace. Also i can't able to use the namespace as "admin" even though i have created a folder in the web folder with a name admin.
Please be clear that Struts2 namespace is nothing related to folder/any other resource in your web-application.
Namespace inside Struts2 subdivides action configurations into logical modules, each with its own identifying prefix.Namespaces avoid conflicts between action names.
This is what doc say about namespace
Namespaces are not a path!
Namespace are not hierarchical like a file system path. There is one namespace level. For example if the URL /barspace/myspace/bar.action is requested, the framework will first look for namespace /barspace/myspace. If the action does not exist at /barspace/myspace, the search will immediately fall back to the default namespace "". The framework will not parse the namespace into a series of "folders". In the Namespace Example, the bar action in the default namespace would be selected.
I suggest you to go through the official documentation of Namespace to get an idea what they are and how they work inside S2
namespace-configuration
I am just wondering whether there is any work regarding the generation of static html files containing the output of the corresponding view of model objects.
Such an approach should also be able to regenerate outdated html files in case model object content changes.
I have done some research but couldn't find any appropriate solution...
Your question is very hard to parse–some steps/examples of what you're trying to accomplish would help.
"output of the corresponding view of model objects"
Model/objects don't have corresponding views–actions (in controllers) do. I'll assume you're talking about basic CRUD/scaffolding views related to your models.
If that's the case, take a look at render_to_string. It's basically renders a view to a string instead of to the browser.
So, if you wanted some "automatic" generation of html files, you could have a special controller action that loaded some models, looped through them, rendered a view for each to a string, and then saved that string to an HTML file using the model's ID and a time stamp as the name.
If you wanted to get really automatic, you could then call the URL of your special controller action daily/weekly/monthly from a cron job using wget (with some authentication, natch).