swinstead wrote:Hi,
I've been trying out Anywhere Slider and it's been working just fine.
I do want to show a slider on a specific Topic page. The documentation does tell me how to create a custom widget zone on a layout, etc. So if I wanted a slider to appear on each Topic page, I could do that.
But is there a way to show a slider on a specific Topic page?
Hi swinstead,
Sadly, nopCommerce does not have the functionality to add script or razor code to topics. To accomplish this you need to modify the
/Views/Topic/TopicBlock.cshtml view.
Find the following code:
<div class="topic-html-content-body">
@Html.Raw(Model.Body)
</div>
and modify it to look like this:
<div class="topic-html-content-body">
@Html.Raw(Model.Body)
@if (Model.SystemName == "YourTopicName")
{
@Html.Widget("custom_widget_zone")
}
</div>
You need to replace
YourTopicName with the system name of the topic, in which you want to add the custom widget zone and
custom_widget_zone with the name of your custom widget zone. You can do this for as many widget zones or topics as you like.
After this follow the documentation on how to add a custom widget zone and add the widget zone to the
SupportedWidgetZones.xml file.
Regards,
Ivan Stoyanov