Physical page based on masterpage referencing

Posted by Community Admin on 04-Aug-2018 14:14

Physical page based on masterpage referencing

All Replies

Posted by Community Admin on 01-Jul-2011 00:00

I am working on migrating a contact form from ASP.NET WebForms over to Sitefinity small business edition.  I created the page and have it's MasterFile set to the masterpage that is being used for the template via the admin area for all public pages.  When I navigate to the page it comes up and even functions in that I can send a submission and receive the email, but the theme is not being applied to the page.

I added the following code to my page, but do not see that it is linking anything when I view the source.  Is the process I just described the way to do this or should I be looking at wrapping this form into a user control and drop it into a page as a widget instead?

<sitefinity:ResourceLinks id="resourcesLinks" runat="server" UseEmbeddedThemes="false">
 <sitefinity:ResourceFile Name="Global/Structure.css" />
</sitefinity:ResourceLinks>

I tried the above with and without the UseEmbeddedThemes set.

The path to my theme is: ~/App_Data/WebSiteTemplates/CompanyName/App_Themes/Default

Under the theme I have a Global and Images folder.  Structure.css sits within the Global folder.

Posted by Community Admin on 02-Jul-2011 00:00

Give this a try?

/Sitefinity/WebsiteTemplates/CompanyName/App_Themes/Default

I know this isn't the physical path, but there's some rewriting going on

Posted by Community Admin on 05-Jul-2011 00:00

Hi Stacey,

Have you registered your theme in the Advanced Settings/Appearances/Frontend_themes? It it necessary to register the theme and it will be available in the Theme Tab of your Page Template. You don't have to add any code in your page so that the theme is registered, so you can remove the explicit loading of resources as everything from the folder is registered.

My suggestion is to verify what I have suggested and if you still experience problems with applying your theme, you can send us your project or give us some kind of access where we will try to resolve the issue immediately.

Thank you for contacting us and please let me know if you have any other questions.

Regards,
Hristo Borisov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 05-Jul-2011 00:00

@Steve :  I will give that a try when I get a chance.  I know about the routing, but I got so focused on the documentation stating that it resourcelinks will pull the currently assigned theme that I didn't even try to put the full path as you suggest.

@Hristo:  I think we are talking about two different things here.  I have a small business site that has a frontend theme registered and it is working fine.  This site is being migrated from an older in-house CMS system that we developed.  It has a contact webform that needs to be brought over, but since this is a small business license I cannot use the form builder.  My attempt was to bring the page over as it is with as little adjustment as possible.

I need this physical page to inherit the same theme as the virtual pages so I have it based off the masterpage that I created under the normal App_Data file structure.  I will try Steve's suggestion, but I am wondering if the ResourceLink control only works within context of where it is dropped?  Meaning does it only pick up the currently assigned theme if it is part of a widget that is being dropped onto a page or should I expect to see results by dropping it onto physical pages too?

Let me try this one last thing and then I will submit a ticket where I link this project if you want to take a peak at it.

Posted by Community Admin on 05-Jul-2011 00:00

Using  /Sitefinity/WebsiteTemplates/CompanyName/App_Themes/Default  for the path in the ResourceLinks control did not help.  I decided to just create that page as a UserControl and register it to be dropped onto a page. 

Posted by Community Admin on 05-Jul-2011 00:00

Try adding the tilde (~) to the front?

<sf:ResourceLinks id="resourcesLinks2" runat="server" >
  <sf:ResourceFile Name="~/Sitefinity/WebsiteTemplates/CompanyName/App_Themes/Default/Global/Structure.css" />
</sf:ResourceLinks>

(Assuming that is the path)

Posted by Community Admin on 05-Jul-2011 00:00

The tilde does not help either.  I have it working as a registered toolbox item now so I am not too worried about it, but it is nagging at me that I am missing something basic here ;P

Posted by Community Admin on 05-Jul-2011 00:00

Yeah Wierd...

What happens if you (in browser) just type in the URL?

http://<yoursite.com>/Sitefinity/WebsiteTemplates/CompanyName/App_Themes/Default/Global/Structure.css

Does it download?

Posted by Community Admin on 05-Jul-2011 00:00

putting in the full path in the browser brings up the css file I am trying to link.

Posted by Community Admin on 05-Jul-2011 00:00

Out of curiosity I added the ResourceLink control to the UserControl that I created and find that it does indeed work there with the way I am referencing it.  It seems it has something to do with using this control on a physical page versus a control that will be registered.

Obviously I do not need to have it on the UserControl since it will already inherit the selected theme when I drop it on the virtual page, but I was able to verify that my css file gets linked twice which is what I would expect to see.

This thread is closed