Giter VIP home page Giter VIP logo

Comments (6)

github-actions avatar github-actions commented on July 17, 2024

Thank you for submitting your first issue, awesome! 🚀 We're thrilled to receive your input. If you haven't completed the template yet, please take a moment to do so. This ensures that we fully understand your feature request or bug report. A core team member will review your issue and get back to you.

If you like Orchard Core, please star our repo and join our community channels.

from orchardcore.

Piedone avatar Piedone commented on July 17, 2024

You shouldn't really need to do that. The default shape template does the same as the code sample in the docs. Site is a property on the view and thus available by default.

Probably you need this line in your theme's _ViewImports.cshtml (see the built-in one)?

@inherits OrchardCore.DisplayManagement.Razor.RazorPage<TModel>

from orchardcore.

ccnicholls99 avatar ccnicholls99 commented on July 17, 2024

OK. Nice thanks for the heads-up, I was there was something I was missing.

Although if I put that in _ViewImports.cshtml then every other Razor Page in my project backed by a model will throw an error. If I put it in just the _Layout.cshtml instead, then it appears to work without issue.

Either way, it would be helpful to have the above advice in the documentation page I highlighted.

from orchardcore.

Piedone avatar Piedone commented on July 17, 2024

Sorry, I'm confused about what exactly you're doing. Can you share the code?

Because I don't understand how you're using Razor Pages. Or by "Razor Page" do you mean a Razor view template? Do you have a custom Admin theme as explained here? You shouldn't need a _Layout file there, and that's definitely not the recommended approach.

from orchardcore.

ccnicholls99 avatar ccnicholls99 commented on July 17, 2024

All I am trying to point out is that the code sample presented in the documentation page is missing the details on how to get a reference to the Symbol @Site.Sitename. I think you could clarifiy this by adding one or two lines of extra code to the sample...(razor example) to make it obvious where the @Site symbol is coming from...

@* ...In a custom Admin theme: Site variable is automatically available using... *@
@inherits OrchardCore.DisplayManagement.Razor.RazorPage<TModel>
@* ...from a random layout or view...inject the SiteService...*@
@inject OrchardCore.Settings.ISiteService SiteService
@{  var Site = await SiteService.GetSiteSettingsAsync(); }

[rest of Code Sample]

from orchardcore.

Piedone avatar Piedone commented on July 17, 2024

OK, thanks for explaining. Though neither should really be needed:

  • If you're in an (admin) theme, then this inherits is already implied (at least if you generated the theme with the OC codegen templates or followed the docs). So the Site property should be available.
  • In other cases, while indeed you need to resolve ISiteService to access the site settings, that's not about customizing the admin branding anymore. For that, you need an admin theme.

So I'm just confused about what exactly are you doing and thus unclear about which part of the documentation needs to be updated.

from orchardcore.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.