InitializeFrontend- get page id

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
kuzmany
Power Poster
Power Poster
Posts: 448
Joined: Tue Oct 10, 2006 5:00 pm
Location: Bratislava

InitializeFrontend- get page id

Post by kuzmany »

Hello folks,

is there way to find current page id in InitializeFrontend function?

I need for my MleCMS module and CmsNlsOperations::set_language_detector($obj) usage.

get_pageid_or_alias_from_url() is internal and private function, its use violates the rules, its use violates forge rules-

Thank you.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: InitializeFrontend- get page id

Post by calguy1000 »

cms_utils::get_current_pageid();
cms_utils::get_current_content();

Though I don't know if that will work... because modules (those that aren't lazy loaded) are loaded before the url is parsed and before the e content object is loaded.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
kuzmany
Power Poster
Power Poster
Posts: 448
Joined: Tue Oct 10, 2006 5:00 pm
Location: Bratislava

Re: InitializeFrontend- get page id

Post by kuzmany »

Yeas, content object is loaded after this function and is unusable with/without lazyloading.

Thank you, I will try to find another way.
nockenfell
Power Poster
Power Poster
Posts: 751
Joined: Fri Sep 12, 2008 2:34 pm
Location: Schweiz / Switzerland

Re: InitializeFrontend- get page id

Post by nockenfell »

kuzmany wrote:Yeas, content object is loaded after this function and is unusable with/without lazyloading.

Thank you, I will try to find another way.
if you have a soluction, can you share it?
kuzmany
Power Poster
Power Poster
Posts: 448
Joined: Tue Oct 10, 2006 5:00 pm
Location: Bratislava

Re: InitializeFrontend- get page id

Post by kuzmany »

nockenfell wrote:
kuzmany wrote:Yeas, content object is loaded after this function and is unusable with/without lazyloading.

Thank you, I will try to find another way.
if you have a soluction, can you share it?
InitializeFrontend not used in my solution. I will try to use some event.
kuzmany
Power Poster
Power Poster
Posts: 448
Joined: Tue Oct 10, 2006 5:00 pm
Location: Bratislava

[Solved] Re: InitializeFrontend- get page id

Post by kuzmany »

My bad.

This works with disable LazyLoadFrontend in CMSMS 1.11.1
Post Reply

Return to “Developers Discussion”