3 Replies Latest reply: Jun 1, 2010 12:45 PM by 646538 RSS

    Way to refer a static html file in apex region source

      I am new to Apex development and trying to build a page in APEX. I have a HTML region in my page and the region source(the size of the HTML code) for this region is very large. So with this huge size html text whenever i am saving the region, its erroring out saying "Page can not be displayed".
      Is there a way to save this HTML code in a .html file as a static file in the APEX application -> Shared Component and refer the same in the Region source

        • 1. Re: Way to refer a static html file in apex region source
          Not sure about your chosen solution for this problem, however, you can refer directly to static files in code. Generally speaking, you refer to images but other file types will also work:

          So, you upload your chosen file to the 'static files' section of the application editor (refer to the documentation for help on this).

          Once the file is in, you can refer to it in code using the +#WORKSPACE_IMAGES#+ substitution string e.g.:
          Thereafter, you could refer to it in an html region like so:
          <a href="#WORKSPACE_IMAGES#mygroovyfile.txt">download my file</a>
          (You can also alternate this with the +&WORKSPACE_IMAGES.+ equivalent in certain circumstances)
          • 2. Re: Way to refer a static html file in apex region source
            Hi JoelC,
            Basically my problem is, i am trying to keep the look and feel of my page same as some standard pages and for that i have got the js and css files which i need to make use of.
            So to get that look and feel in my page(Say i need some particular links,text in header region and something else in footer region), i have created header and footer region.
            In those region's sources, i am trying to write html code which will refer those standard js and css file and render the same look.

            But probelm is: the html code is much bigger in size and apex is not taking that, so instead i wanted to keep the html code in a .html static file and refer that in the region source.

            I tried whatever you have suggested, but it failed. I am not understanding where should i write #WORKSPACE_IMAGES#mygroovyfile.txt ??

            Is region source the only place where i should write #WORKSPACE_IMAGES#mygroovyfile.txt

            I tried this, but its not working

            Can you help me further with this ?

            • 3. Re: Way to refer a static html file in apex region source
              Sorry, I think I've made a mistake - you should use the alternative '&' notation inside html:
              It sounds to me like you want to amend the page template, rather than the individual pages themselves. If you go into the 'Shared Components' section of your application and click on the 'templates' link, you will be presented with the various templates used in your application. You are mainly interested in the Page Templates here.

              I would recommend making a copy of the relevant page template you want to base your new work on, just in case you make an error and want to go back to the old format. Make the appropriate amendments - I would refer to the current templates to see how they refer to static CSS and js files, although the code you'll write will probably follow the basic formula laid out below e.g:
              <link rel="stylesheet" href="&WORKSPACE_IMAGES.my_bodacious_css_file.css" type="text/css" />
              <script src="&WORKSPACE_IMAGES.my_awesome_js_lib.js" type="text/javascript">
              Once you are happy with the changes, just refer your new template in the page (or even change your default page template accordingly) and try the page again.