Hi, I have an odd problem. When attaching my module to a page (new paragraph, attach module, save and close) the module's GetContent() is obviously executed!! It messes up the css for the admin-page, and output any Dynamicweb.Base.w(message) calls on top of the right frame in the admin view.
What is wrong? Is it the normal behaviour for dw?
Thank's for any help,
Developer forum
E-mail notifications
GetContent() executed in dw admin view!
Jon Lennryd
Posted on 10/08/2011 15:52:15
Replies
Morten Snedker
Posted on 10/08/2011 16:19:17
Hi Jon,
Is it at custom module you're attaching?
If so: Yes, if it has a GetContent (because it is a content module) then it is rendered, naturally. That is by design and desired behaviour. If you have any Base.w() in the GetContent, then yes, it will mess up the page. Dynamicweb.Base.w() corresponds a "Response.Write". This will just response write to the top op the page, thus messing up the design.
The Base.w() method is intended for debug only, not production use.
Let me know if I'm getting you right!
Best regards
Morten Snedker
Nicolai Høeg Pedersen
Posted on 11/08/2011 09:38:36
It is normal behavior - when showing a paragraph list, the page is also rendered and hence also your custom module.
Base.w is the one "fucking-up". Do not use base.w in for other than debugging things...
Base.w is the one "fucking-up". Do not use base.w in for other than debugging things...
Jon Lennryd
Posted on 11/08/2011 15:14:14
Sorry Morten for being unclear. As Nicolai says I mean the paragraph listing in the dynamicWeb administrator view. (Navigation, clicking a page, and the page's paragraph listing is shown.)
It is not just Base.w which is creating problems, it is the css loading and disturbing the layout. This will happen even if I don't have Base.w debug output enabled.
My workaround is to check if the current user is admin, and then return an empty string.
What is the reason the GetContent() is called in the paragraph list? The output is not used, as far as I know.
Might be hard for you to answer, but why is not every module I have developed giving this problem, I load css and output status with Base.w in all of my modules?
It is not just Base.w which is creating problems, it is the css loading and disturbing the layout. This will happen even if I don't have Base.w debug output enabled.
My workaround is to check if the current user is admin, and then return an empty string.
What is the reason the GetContent() is called in the paragraph list? The output is not used, as far as I know.
Might be hard for you to answer, but why is not every module I have developed giving this problem, I load css and output status with Base.w in all of my modules?
Nicolai Høeg Pedersen
Posted on 11/08/2011 15:17:57
This post has been marked as an answer
Base.w outputs in top of the html document breaking your doctype and hence html standards compliance rendering mode - so never do that.
It is true that the pageview and the getcontent of modules are invoked on paragraph list - analyzed for SEO purposes i.e. But nothing is written to the browser unless you use Base.w or repsonse.write which you should not.
Feel free to paste your getcontent - and I'll tell you what is wrong.
It is true that the pageview and the getcontent of modules are invoked on paragraph list - analyzed for SEO purposes i.e. But nothing is written to the browser unless you use Base.w or repsonse.write which you should not.
Feel free to paste your getcontent - and I'll tell you what is wrong.
Votes for this answer: 0
Pavel Volgarev
Posted on 11/08/2011 15:19:30
Hi Jon,
Do you use HttpResponse.Write within your module? If so - please don't. Fill out the template tags instead.
As for why the content modules are executed on a paragraph list - one of the reasons is the SEO module that needs a complete page output in order to provide you with suggestions of how to optimize your page against search engines.
-- Pavel
Do you use HttpResponse.Write within your module? If so - please don't. Fill out the template tags instead.
As for why the content modules are executed on a paragraph list - one of the reasons is the SEO module that needs a complete page output in order to provide you with suggestions of how to optimize your page against search engines.
-- Pavel
Nicolai Høeg Pedersen
Posted on 11/08/2011 15:24:56
By the way - adding CSS or JS files on a pageview from a module:
PageView.Current.AddJavascript("/Files/System/myscript.js")
PageView.Current.AddStylesheet("/Files/System/mycss.css")
PageView.Current.AddJavascript("/Files/System/myscript.js")
PageView.Current.AddStylesheet("/Files/System/mycss.css")
Jon Lennryd
Posted on 12/08/2011 13:24:05
Thank's for all the answers. Yup, when I remove the Base.w() output, the css is no longer included and everything looks nice.
I use this neat function, so I don't have to trash all my debug output before I deliver the page. Any calls to this function disappear when I compile in Release mode.
Only (minor) problem with this solution is that during development, the output still get disturbed in dynamicWeb admin view.
I use this neat function, so I don't have to trash all my debug output before I deliver the page. Any calls to this function disappear when I compile in Release mode.
[System.Diagnostics.Conditional("DEBUG")] public static void DebugMessage(string message) { Dynamicweb.Base.w(message); }
Only (minor) problem with this solution is that during development, the output still get disturbed in dynamicWeb admin view.
You must be logged in to post in the forum