shouldn't mojobasepages which are not a cms page and are not created by user exhibit a different id?

This is a forum to suggest new features for mojoPortal. 

This thread is closed to new posts. You must sign in to post in the forums.
8/4/2011 3:47:16 AM
Gravatar
Total Posts 192

shouldn't mojobasepages which are not a cms page and are not created by user exhibit a different id?

shouldn't mojobasepages which are not a cms page and are not created by user exhibit a different id and guid?

say id should be -1 or something for them?

currently I have a control that I want to be shown on the default page (id 0), but all pages which don't have an Id set exhibit id 0 (and it's the same  for GUID) and that control is shown on all such pages, e.g: admin pages .

8/4/2011 6:44:59 AM
Gravatar
Total Posts 18439

Re: shouldn't mojobasepages which are not a cms page and are not created by user exhibit a different id?

mojoBasePage is just a base class for .aspx pages, the business object that represents a CMS page is PageSettings currentPage = CacheHelper.GetCurrentPage();

so anytime that you get the current page it is always based on the pageid of the request, if no pageid is in the query string it returns the first page in the site (the root level page with the lowest sort), ie the home page. 

non  cms .aspx pages do not have a PageSettings, only CMS pages have that so if you try to get the current page on non cms pages it will still be based on the pageid in the query string and if there is none then it will be the home page. For feature edit pages we have to pass the current pageid in as a query string param.

Hope that helps,

Joe 

ps this is not a feature request it would have been a better question in the developer forum

8/4/2011 6:59:03 AM
Gravatar
Total Posts 192

Re: shouldn't mojobasepages which are not a cms page and are not created by user exhibit a different id?

perfectly true,

but shouldn't this:

"if you try to get the current page on non cms pages it will still be based on the pageid in the query string and if there is none then it will be the home page."

change?

when no pageid is in the query string, should't a different page id than all CMS pages including home page, say "-1" or anything, be returned? (the same for pageGUID)

8/4/2011 7:09:00 AM
Gravatar
Total Posts 18439

Re: shouldn't mojobasepages which are not a cms page and are not created by user exhibit a different id?

No, it has to work this way or the root url would not work, the root url has no page id and it must return the home page.

If you just want to know if a page id is present or not you can do it like this:

pageId = WebUtils.ParseInt32FromQueryString("pageid", -1);

then pageid will be -1 if it is not found in the query string

8/4/2011 7:35:22 AM
Gravatar
Total Posts 192

Re: shouldn't mojobasepages which are not a cms page and are not created by user exhibit a different id?

well, I guess what I'm saying won't break the home page as the default page for root url.

this is the code I use in my custom control:

(myCode.PageGuidExistsInDB(((mojoBasePage)Page).CurrentPage.PageGuid)

this.visible = true;

I have some other admin pages through which I define where this control is shown.

if this control is selected to be shown on the home page, then it will be shown on all site non-CMS-pages ,all non-CMS pages exhibit same id and guid of home page.

what is requested is not to break default id system, I want the other side changed, I want non-CMS pages show a different id. there is no problem with showing the home page when no page id is specified in the url.

does it take much time to implement?

 

8/4/2011 8:27:04 AM
Gravatar
Total Posts 18439

Re: shouldn't mojobasepages which are not a cms page and are not created by user exhibit a different id?

sorry but what you are asking for makes no sense to me and doesn't sound like something I want to change in mojoPortal. You should be able to implement your own logic in your own helper method to figure out whatever it is you're trying to figure out about the current request, you don't need to have it in the base page code. If you don't like the logic for currentPage then study the code and make your own logic for checking a different way.

Best,

Joe

8/4/2011 8:48:40 AM
Gravatar
Total Posts 192

Re: shouldn't mojobasepages which are not a cms page and are not created by user exhibit a different id?

well, I just didn't want to change everything in mojoportal core, and thought you or any of the users might face a similar issue.

 

8/4/2011 8:51:52 AM
Gravatar
Total Posts 18439

Re: shouldn't mojobasepages which are not a cms page and are not created by user exhibit a different id?

maybe you have not explained what you are trying to accomplish well enough for me to understand it. It is not clear to me why a change in mojoPortal is needed to accomplish what you are trying to do. It seems like it could be done without modifications to mojoPortal.

8/4/2011 9:12:11 AM
Gravatar
Total Posts 192

Re: shouldn't mojobasepages which are not a cms page and are not created by user exhibit a different id?

well,

http://eranews.ir/home.aspx

on home page you see a news cycle control which can have up to 10 news image and text.

site admin selects which pages this control is to be visible on.

he says for example he wants this control to be visible in home.aspx and specifies a data source for it. (the source data is from a customized blog module)

I have put this news cycle control in layout.master and on_load, based on page id, it knows if it must be visible or not, and also loads it's page specific data.

if admin adds one to page 2 and specifies data for it, ok, it will just be shown on page with id #2.

but if he adds this control to home page, this control shows up in every admin page and every module edit page. because in all those pages, page id is equal to home page pageID that is 0.

I thought this is innormal, every CMS page should have a unique page id, including the home page, and if a mojobasepage is not a CMS page, it must not say it's pageid is equal to home page. it must return another default value like -1.

 

8/4/2011 9:24:37 AM
Gravatar
Total Posts 18439

Re: shouldn't mojobasepages which are not a cms page and are not created by user exhibit a different id?

if you build a feature the normal way then you can put it on different pages with different module settings.

directly putting it in layout.master is not the way to go, I would never implement something as you have described.

Even so, if you don't want it on non cms pages, you can do code like this:

if(!Page is CmsPage) { Visible = false; }

Hope that helps,

Joe

8/4/2011 9:38:18 AM
Gravatar
Total Posts 192

Re: shouldn't mojobasepages which are not a cms page and are not created by user exhibit a different id?

best thanks.

I did this because they don't fit the normal module space. that newsticker on the top for example is to extend the whole page length under menu, it's not to sit in any of the three columns.

You must sign in to post in the forums. This thread is closed to new posts.