9 Replies Latest reply: Jun 25, 2007 4:44 PM by Nick Bacon RSS

    Finding the pageid of the current page

    3004
      I'm trying to figure out how to find out the pageid (from wwpob_page$) of the current page. Can't find anything in the PDK that shows how to do it.
        • 1. Finding the pageid of the current page
          3004
          If you are running a custom portlet using PLSQL, you can take it from p_portlet_record.page_url where
          p_portlet_record is one element of this type

          type portlet_runtime_record is record (
          portlet_id number
          ,provider_id number
          ,node_id number
          ,reference_path varchar2(100) -- NOTE!!! verify this
          ,language varchar2(30)
          ,exec_mode number
          ,back_page_url varchar2(4096)
          ,page_url varchar2(4096)
          ,page_type varchar2(200)
          ,has_title_region boolean
          ,has_border boolean
          ,caching_key varchar2(55)
          ,caching_level varchar2(30)
          ,caching_period number);

          If you are running other kind of portlet, i don't know how, but i'd like to know that too


          Pedro Ribeiro
          • 2. Re: Finding the pageid of the current page
            487567
            Bump!

            This does not work in 10.1.4 since page_url no longer contains page_id, all URLs that i get are friendly urls.

            already spent 2 days trying to find a simple answer for this be it a function call or whatever. This is getting very annoying since this is quite a simple thing - knowing the current page.
            • 3. Re: Finding the pageid of the current page
              221047
              Hello there

              From 10.1.4 the page url has changed and you now get the full page path. You'll need to filter that part out including the / at the beginning

              For example let's say that your url looks like this:
              http://yourserver:port/portal/page/portal/pgr1/page1/page2
              The acutal page path is then /pgr1/page1/page2

              There is a procedure inside the portal schema that you can use, but the only downside is that it has alot of out parameters. The following example procedure, uses it to filter out the pagegroup and pageid based on the page path you pass through.

              PROCEDURE Prc$Get_Pg_Pa_Id
              (prp_page_path IN VARCHAR2, prp_pg_id OUT NUMBER, prp_pa_id OUT NUMBER) IS

              lv_path VARCHAR2(2000);
              lv_names owa.vc_arr;
              lv_values owa.vc_arr;
              lv_url_format NUMBER;
              lv_siteid NUMBER;
              lv_pageid NUMBER;
              lv_tabid NUMBER;
              lv_item_container_siteid NUMBER;
              lv_item_container_pageid NUMBER;
              lv_selected_tabs VARCHAR2(2000);
              lv_thingid NUMBER;
              lv_thing_siteid NUMBER;
              lv_is_item_stage_version BOOLEAN;
              lv_hit_version BOOLEAN;
              lv_smd_status portal.wwpob_smd.smd_status_record;
              lv_url_version VARCHAR2(2000);

              BEGIN
              portal.wwpob_api_path.translate_path(prp_page_path, lv_names, lv_values,
              lv_url_format, lv_siteid, lv_pageid, lv_tabid,
              lv_item_container_siteid, lv_item_container_pageid,
              lv_selected_tabs, lv_thingid, lv_thing_siteid,
              lv_is_item_stage_version, lv_hit_version,
              lv_smd_status, lv_url_version);
              prp_pg_id := lv_siteid;
              prp_pa_id := lv_pageid;
              END;

              Don't know how supported this method is, but at least it does the job we want it to do and since it's from Oracle itself it ought to be more or less correct.

              Hope this helps

              Regards
              Johan
              • 4. Re: Finding the pageid of the current page
                Nick Bacon
                Did you write this procedure yourself? If not, where is it located in the PORTAL schema?
                Also, can you provide a simple way to return the page path? I see that it needs to be passed into the procedure, but I am not sure how to get it.
                Thanks,
                Nick
                • 5. Re: Finding the pageid of the current page
                  476731
                  if someone gets a solution, plz let me know. I need the page id on the page using PL/SQL or any of the API in Portal 10.1.2 release 2.

                  This will be a major breakthrough for me. Plz help.
                  • 6. Re: Finding the pageid of the current page
                    Oliver L
                    If you use it in header try it like:

                    l_path_begin := instr(owa_util.get_cgi_env('PATH_INFO'), '/', 1, 2);
                    l_server_name := owa_util.get_cgi_env('SERVER_NAME');
                    l_page_url := 'http://' || l_server_name || substr(owa_util.get_cgi_env('PATH_INFO'), l_path_begin);
                    l_page_id := mpl_general_func.get_page_id(l_page_url);


                    u can test all variables u get if u use:
                    owa_util.get_cgi_env;

                    I have used it in pl/sql area, but it worked only at beginning of a page.
                    • 7. Re: Finding the pageid of the current page
                      Nick Bacon
                      As part of your solution you are using mpl_general_func.
                      Where/what is this package?

                      Thanks,
                      Nick
                      • 8. Re: Finding the pageid of the current page
                        Oliver L
                        its only a function which converts url to pageid.

                        use table: wwsbr_all_folders and make a recursive call
                        • 9. Re: Finding the pageid of the current page
                          Nick Bacon
                          Could you please explain this a bit further? I am still not quite understanding what I should be doing with the mpl_general_func function. Is this a function that you wrote to search through the wwsbr_all_folders table using the URL you generated?
                          From what I can tell, the wwsbr_all_folders only stores urls for pages that require them (such as redirect pages). In other words, there is not a url stored in this table for every portal page, so I cannot take a URL and use it to search the wwsbr_all_folders table and pull page id.
                          Thanks.

                          Message was edited by:
                          Nick Bacon