WebStorm Live Template for JSX, include default field without definition - webstorm

I'm trying to create a live template for a Route component in WebStorm:
<Route exact path="$PATH$" component={$COMPONENT$}/>$END$
The problem is that it completes like so:
I don't want to give any 'definition' to exact. I just want it to look like:
<Route exact path=$VAR1$ component={$VAR2$} />
I've tried escaping it in a couple of different ways, and I can't currently find any information about this from JetBrains.
How do I create a live template for something like this?
Edit: here's an image of my config:

Related

Changing default base URL of Sitecore ServiceApiController, Is it possible?

when we implement SitecoreApiController, for each action method we make using Sitecore.Services.Core.ServicesController("namespace") attribute, we get a url like this:
/sitecore/api/ssc/{namespace}/{controller}/{id}/{action}
I wonder if we could change this default pattern, somehow in config files. I particularly interested in /sitecore/api/ part, because sometimes in the sense of security concerns, certain clients don't like to reveal that much about CMS platform behind the scene. Sometimes they even ask us to hide anything in HTTP header that tells about Microsoft ASP.NET explicitly.
Is this possible here?
Edit
this link shows a way to customize it using pipelines but I wonder if we could change the base url just through config files without needing a custom pipeline
I had a look at it, and I think I found out how - although I haven't tested it.
It looks for a setting named Sitecore.Services.RouteBase and if it can't find it, it uses sitecore/api/ssc/ as the default value.
You should be able to change it with a config patch like this in the App_Config/Include folder:
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
<sitecore>
<settings>
<setting name="Sitecore.Services.RouteBase" value="custom/api/" />
</settings>
</sitecore>
</configuration>

RenderComponentPresentation before any other markup Tridion Razor Page

I have a page template in Tridion 2011 with Razor code that prints information based on RenderComponentPresentation() as the first thing in the page. No other markup comes before it, because the component, not the page, contains the initial markup. Unless I put at least one character before the first RenderComponentPresentation in the published output, the template refuses to render any presentations.
So, for example, if this is all that is in the layout TBB this works (in my real code the tcms are real of course):
<
#RenderComponentPresentation("tcm:mytcm","tcm:myothertcm")
but this does not
#RenderComponentPresentation("tcm:mytcm","tcm:myothertcm")
The first prints the contents of the component preceded by the "<", whereas the second does nothing at all. I don't want to have ANY markup directly at the start of the page template, I want the first thing to be the component. Is it possible?
I've just done a quick test in Template Builder using the latest version of the Razor Mediator (1.2) and couldn't replicate your issue.
Maybe you could try:
<text></text>
#RenderComponentPresentation("tcm:mytcm","tcm"myothertcm")
It won't render any additional markup but may trick the mediator into doing what you want (though like I said, I can't replicate your problem so can't verify whether it does).
Normally with Razor you iterate over any and all Component Presentations on the page, and right now I'm working with
#foreach(var cp in ComponentPresentations){
#cp.RenderComponentPresentation()
}
This will render every component on the page, regardless of predefined schema's or templates. Your issue however suggest a problem elsewhere. What kind of output does your page template generate (do mind its the page template using a compound template which in turn includes the Razor TBB you describe here). Is it .aspx, HTML or other? And what is the Component templates' output? is it an HTML fragment, or anything else?
As far as you syntax goes, that should be just fine other than the template invocation:
#RenderComponentPresentation("tcm:x-xxx-xx", "tcm:xx-xxx-xx")
I have a feeling this code only works when used within HTML tags, though, but that's just a hunch.
Bit of a hack but have you tried:
<text>#RenderComponentPresentation("tcm:x-xxx-xx", "tcm:xx-xxx-xx")</text>
or
#Html.Raw(RenderComponentPresentation("tcm:x-xxx-xx", "tcm:xx-xxx-xx"))
Disclaimer: not really used Razor mediator. Just Razor.

modx is only showing html code, not the template

I have installed ModX and Downloaded the "Basic" Template in the Extensionmanager! I chose the Basic Template at my first Page for the Resource! I cant find a Globalsetting to choose an Template? My problem is that if iam going to the site i only get the pure html code shown, no website! Why is this?
AFAIK there is no "Globalsetting" to choose a template. One of the nice things with MODX is that each resource can specify which template to use. So you can mix and match as required.
You could check if you have set the base href tag in head like this:
<base href="http://www.yoursite.com"/>
It will tell the site where to start looking for the other files that you have included in your markup.

Magento - catalog.xml not using correct template

Noob developing a Magento theme and I can't seem to figure out why Magento is not using the path I specify in the setTemplate action on catalog.xml.
I've got my own theme in /app/design/frontend/default/mycustomtheme and I've been patching files over from the base and making changes.
I've copied over /app/design/frontend/base/default/layout/catalog.xml to my custom theme at /app/design/frontend/default/mycustomtheme/layout/catalog.xml. I've set the template to be a specific phtml file...
<catalog_product_view translate="label">
<label>Catalog Product View (Any)</label>
<!-- Mage_Catalog -->
<reference name="root">
<action method="setTemplate"><template>page/2column.phtml</template></action>
</reference>
Yet it's not working. Can someone spot what the problem might be? I've got all cache disabled and other changes I make I can see immediately, just not this one.
edit: I should note, if I change something else in the catalog_product_view xml node I see those changes are reflected. For instance if I remove <action method="addJs"><script>varien/product.js</script></action> then I see the reference is removed in the rendered html file.
edit2: Adding images to address questions ...
did you setup-up / configured the theme from your store backend?
Yes, and it's actually loading the correct header and footer, and it's properly styled.
Are you sure you have such template under /app/design/frontend/default/mycustomtheme/template/page/ directory?
Yes, I can confirm the file is there
OMG. The (one and only) product I was testing on had a specific layout set under the "Design" section. So I guess that was overriding anything I had set in catalog.xml
I'd like to have the 3 hours of my life back.

How can I have ColdFusion tags in a variable and have them evaluated?

I've get a variable that can contain a CF custom tag. E.g.
<cfset a = '<model:sparkline id="1"/>'/>
And I'd like that to be evaluated into HTML and outputted. Not sure how/if I can do this.
Can you modify the custom tag? If so you can use the caller scope to set a variable in the calling page. So inside the custom tag you could do <cfset caller.a = "whatever" /> and that will set the value in the calling page's variables scope.
If you don't want to modify the custom tag, then you can use <cfsavecontent> to save the output to a variable. Example:
<cfsavecontent variable="a">
<model:sparkline id="1" />
</cfsavecontent>
Sean Coyne's answer is the correct one, provided the import is included within the same context as the cfsavecontent tag:
<cfimport taglib="./tags" prefix="model">
<cfsavecontent variable="a">
<model:sparkline id="1" />
</cfsavecontent>
<cfoutput>#a#</cfoutput>
Will result in the dynamically evaluated output of the sparkline customtag.
It's impossible to OUTPUT the code and have it execute. OUTPUT just means output. It doesn't mean "run".
The only way to get CF code to be executed by CF is to follow normal channels:
* request a template;
* include a template;
* call a template as a custom tag or CFMODULE;
* call a method in a CFC;
* any others? ANyway, you get the point.
So if you have code that you create dynamically and want to execute... you need to write it to a file and then call it via the most appropriate of those mechanisms. Be warned though: running dynamic code like this has a fair overhead, as the code needs to be compiled before it's run, and compilation is not the fastest process in the scheme of things. The "best" thing to do here is to try to write and compile the file before it's needed, and only re-write the file it it needs updatng. Don't re-do it every request. But, ideally, don't do this sort of thing at all. One can usually approach things a different way.