Since, v13 or v14, I heard that we can use "iRender" or something to inject a 2sxc module into the skin.
This was the previous way Is it possible to load a specific 2sxc module in a DNN skin?
What is the newest code for injecting a 2sxc module into a DNN theme?
The idea here is to Render the output of a 2sxc module that is already on a DNN page. You are literally inserting the rendered HTML results of the module.
So in a user control, any theme (skin or container) file, like Main.ascx, you can now (2sxc v14.01+) do this nicely with the following code. All you need to know are the page ID and module ID (below you see TabID=44 and ModuleID=122):
<%# Import Namespace="ToSic.Sxc.Dnn" %>
<%# Import Namespace="ToSic.Sxc.Services" %>
<%= this.GetScopedService<IRenderService>().Module(44, 122) %>
There are a lot of great use cases for this that provide the content manager with an easy to use way of editing something in the theme. Examples? Add a Featured Something in to the output of a MegaMenu? A custom list of links or social media icons in the footer without using a janky DNN all-pages module.
Note: that prior to 2sxc v14.01, the function name was .GetService<T>()
Related 2sxc Docs:
DNN Extensnions
RenderService Interface
I just blogged about it today :)
https://2sxc.org/en/blog/post/deep-dnn-skin-and-module-integration-towel-day-2022
Use GetScopedService() and you're good to go
Related
I have a website built by Prestashop. I use PayPal and the template integral_evolution_payment.tpl. When the user goes to the payment page in mobile environment the layout of the page is too small. The buttons and the labels are very small almost unreadable.
How can I customize the page for mobile?
Thank you
Paolo
Module should have a css folder inside module folder at css or views/css. Look for it and modify css styles to accomplish what you need. Sometimes if structure has many changes between desktop and mobile version modules could use a different TPL for each version. Anyway this TPLs should be in module views/templates folder.
Good luck.
I need to add Call tracking for a Marketing campaign on my site that is currently housed in Joomla. It requires a certain script to be added inside the <body> tag only on designated pages.
I know I can add the script tag to the template but that would make it apply to every page. I am still new to Joomla, so can you tell me if there's a way to apply the script below to only the pages we want to track calls from? It needs to go before the </body> tag.
<script type="text/javascript" src="//cdn.callrail.com/companies/808848127/e001797b95eaf41026e7/12/swap.js"></script>
The easiest way to add a script to selected pages is to use an extension such as the professional version of the EasyScript plugin, the Flexi Custom Code module or similar.
It looks like you could also do this with Blank Module which is free. Publish the module to a non-display module position such as "debug" or similar and enable the module only on the required pages by selecting these under the Menu Assignment tab.
For our website we want to use a megamenu that is created with razor.
In the Gravity skin folder of DNN, we have created a folder called MegaMenuNav and we have added our MegaMenu.cshtml and menudef.xml into it.
We have downloaded the ddrmenu example and used it like this:
<dnn:MENU ID="MENU" MenuStyle="MegaMenuNav" runat="server" NodeSelector="*"></dnn:MENU>
we get no error, but nothing is shown as well.
All of the example menus that use token or xslt, such as Dropdown and Mega2DNN are shown, but when we use Razor menus, nothing is shown.
For testing, we added a simple text inside our MegaMenu.cshtml, but again we got no result
Is there anything to do with dotnetnuke?
BTW, we are using .Net 4.5 and Dnn 8.0.2
Thanks in advance
I had an link in my DNN site Menu - pointing to aspx page of my installed module.
I replaced this link with an external link.
And now i wish to change back to old one - aspx from module. BUT am not getting that listed in the dropdown
How to get that back or I missed anything ? I could found the module still in that EXTENSIONS.
Please suggest
Rigin
I think you may be a little confused,
Modules are placed on pages, (One or mor module generally makes up a page.
Menu links refer to pages,
To add a module to a menu it must be on a page.
Once you have placed you module on a page you can select it from the select a web page drop down
A dnn module got 2 pages a view page and a settings page. So you must be sure that your module start's with the correct page.
So what you want is not possible the way you want it.
Best way for you is to control the page in your module. You can control this with for example a user controls(ascx). See image for a default module view.
I have made a custom dnn module. But elements in my module get all styles from dnn.
Is is possible somehow to do a css reset only in module to remove all dnn styles and apply only mine?
This is DotNetNuke's CSS priorities when loading.
DefaultCss: 5
ModuleCss: 10
SkinCss: 15
SpecificSkinCss: 20
ContainerCss: 25
SpecificContainerCss: 30
PortalCss: 35
Information above taken from DotNetNuke Wiki - Client Resource Management API
Numbers are the order the css will be loaded (5 then 10 etc, the default is 100 so this means it should be loaded last.
You could easily add your own css files into your module or if it suits, you can add them to the module.css file within you module. If you are going to use your own CSS/JS file(s) the use the following code
<%# Register TagPrefix="dnn" Namespace="DotNetNuke.Web.Client.ClientResourceManagement" Assembly="DotNetNuke.Web.Client" %>
<dnn:DnnJsInclude runat="server" ID="jsBootstrap" FilePath="~/DesktopModules/MyModuleFolder/js/bootstrap.min.js" />
<dnn:DnnCssInclude runat="server" ID="cssBootstrap" FilePath="~/DesktopModules/MyModuleFolder/css/bootstrap.min.css" />
If you are new to DotNetNuke module development I would suggest looking at this module development template from Chris Hammond (Christoc's DotNetNuke Module Development Template)
Read his blog to find out how to use and install the templates
(Using the new Module Development Templates for DotNetNuke 7)
The best advice I can give you on this is "css specificity". Using the DNN Wiki link provided by the first answer you can learn how/when DNN loads each .css file but to over come styles bleeding into your module you need to understand "css specificity".
It is a good idea to follow the loading order DNN is using as there are benefits to that like when you want to over ride styles in your module from your skin.
You could load your custom module css file last and that could help quite a bit but you should also consider implementing your styles in a more specific way to prevent the other DNN styles from bleeding in.
For example you could wrap your module html in a div tag and give it a my-foo-module class.
<div class="my-foo-module">
Module content here
</div>
Using your css classes like namespaces within your html structure will cause your module styles to take precedence over any other more generic styles that get loaded in. I don't recommend using a reset css file unless you scope it so that it only effects the elements within your my-foo-module wrapper.
Here is some good info that should help you..
http://coding.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/
https://www.google.com/#bav=on.2,or.r_cp.r_qf.&fp=4977db6ad6ac1fe8&q=%22css+specificity%22
And lastly I'll say that if your trying to load a third party css library like twitter bootstrap for your module and your skin is using another library or none at all this can be very challenging to say the least. Your not going to want to edit the entire bootstrap library in order to gain more "Css specificity" for your module so in this case I am unable to offer a solution as I am searching for one myself.