Hello again-
On our website, in the left column, we have a Widget with a slider. I am wanting that same slider widget to appear on our Articles pages (List.cshtml, Search.cshtml, ArticlePost.cshtml).
On the /ArticleRead/List.cshtml, I tried just adding the same widget reference from the _ColumnsTwo.cshtml, like this:
@section left {
@Html.Action("ArticleGroupNavigation", "ArticleRead",new { currentGroupId = currentGroupId, currentArticleId = currentArticleId })
@Html.Widget("left_side_column_after")
}
c:\inetpub\wwwroot\mysite\Plugins\FoxNetSoft.Articles\Views\ArticleRead\List.cshtml(56): error CS1061: 'System.Web.Mvc.HtmlHelper<FoxNetSoft.Plugin.Misc.Articles.Models.ArticleReadListModel>' does not contain a definition for 'Widget' and no extension method 'Widget' accepting a first argument of type 'System.Web.Mvc.HtmlHelper<FoxNetSoft.Plugin.Misc.Articles.Models.ArticleReadListModel>' could be found (are you missing a using directive or an assembly reference?)
I also changed to show smaller thumbnails and limited the number characters in the plugin configuration, until it was optimal in browsers and mobile devices. If you do visit that other post, click the link in the first post and if you squish your browser into mobile device size, you can see what the list looks like with the changes I posted in the forum.
syky27 wrote:
I think this is the right solution, but for people with more than 2 stores, you would need to use if/elseif logic, or in the case of more than 5, maybe a case/switch for better readability.
Maybe at some point, the option for having a separate stylesheet could be added into the plugin configuration as a feature?
..this would at least allow for simple design differences to the List.cshtml, Search.cshtml, and ArticlePost.cshtml views for each store. For most users of the plugin, this would be sufficient.
The "Printer-friendly" version (ArticlePostPrint.cshtml) is different, and already requires manual customization for most people anyway to make it more or less "friendly". (e.g: removing related product-box's and adding their company logo)
Anyway...we love the plugin and appreciate your continued efforts to provide needed functionality!
Steve
Problem solved. This is the code I used on ArticlePostPrint.cshtml:
I changed this:
<link href="/Plugins/FoxNetSoft.Articles/Styles/styles-print.css" rel="stylesheet" type="text/css" />
@{
string currentstore=HttpContext.Current.Request.ServerVariables["HTTP_HOST"];
string imgsrc="";
string alttag="";
if (currentstore == "www.mydomain.com")
{
<link href="/Plugins/FoxNetSoft.Articles/Styles/styles-store1-print.css" rel="stylesheet" type="text/css" />
imgsrc="/content/images/uploaded/store1_logo.jpg";
alttag="Store 1 Name";
}
else
{
<link href="/Plugins/FoxNetSoft.Articles/Styles/styles-store2-print.css" rel="stylesheet" type="text/css" />
imgsrc="/content/images/uploaded/store2_logo.jpg";
alttag="Store 2 Name";
}
}
<a href="@Url.RouteUrl("HomePage")" class="logo"><img alt="Store 1 Name" src="/path/to/my/images/store1_logo.jpg"></a>
Actually, only the imgsrc variable I create is the problem, because the error is further down the page, where I call it:
<a href="@Url.RouteUrl("HomePage")" class="logo"><img alt="" src="@imgsrc"></a>
I forgot about the ArticlePostPrint.cshtml
I also need for it to have it's own styling, and the second store's logo to appear on it.
I have written this code for that view, but it is not working:
@{
string currentstore=HttpContext.Current.Request.ServerVariables["HTTP_HOST"];
if (currentstore == "www.mydomain.com")
{
<link href="/Plugins/FoxNetSoft.Articles/Styles/styles-print.css" rel="stylesheet" type="text/css" />
string imgsrc="/content/images/uploaded/store1_Logo_Print_Friendly.jpg";
}
else
{
<link href="/Plugins/FoxNetSoft.Articles/Styles/styles-NATURALS-print.css" rel="stylesheet" type="text/css" />
string imgsrc="/content/images/uploaded/store2_Logo_print_friendly.gif";
}
}
OK...nevermind....I finally figured out a solution:
I replaced this line on those two views:
Html.AddCssFileParts("~/Plugins/FoxNetSoft.Articles/Styles/styles.css");
string currentstore=HttpContext.Current.Request.ServerVariables["HTTP_HOST"];
if (currentstore == "www.mydomain.com")
{
Html.AddCssFileParts("~/Plugins/FoxNetSoft.Articles/Styles/styles1.css");
}
else
{
Html.AddCssFileParts("~/Plugins/FoxNetSoft.Articles/Styles/styles2.css");
}
steveembry66@gmail.com wrote:
Or maybe it is best to just use host headers to determine which stylesheet to use?
Something like this?
currentstore = Page.Context.Request.Headers.GetValues("Host");
if (currentstore == 'OriginalStoreDomainName.com')
{
Html.AddCssFileParts("~/Plugins/FoxNetSoft.Articles/Styles/store1-styles.css");
}
else
{
Html.AddCssFileParts("~/Plugins/FoxNetSoft.Articles/Styles/store2-styles.css");
}
Thanks for your help!
Steve