Jump to content

Developing w/ Cloud Hosted Version


Go to solution Solved by bfarber,

Recommended Posts

Posted

Due to financial constraints my organization cannot support a self hosted option but I am still looking to develop additional features for our instance. Any advice on good ways to go about this? Right now I am using custom blocks but this requires a terrible conflation of HTML/CSS/JS into one file which is less than ideal. Another issue is there doesn't appear to be any way to utilize BE & FE code for one feature as custom blocks make you utilize just PHP or HTML. Is there a way to utilize ENV variable to hide my API keys in the custom blocks I make?

I know this is a broad question and the answer may just be that I am SOL but I wanted to check in with all of you first before banging my head any further. 

Thanks!

  • Solution
Posted

Within Pages, if you go to Templates in the AdminCP you can create custom CSS and javascript files. When you create individual pages later, you can then choose which CSS or javascript files you wish to embed on which pages, which allows you to separate these resources. That said, this doesn't directly help if you intend to take that custom block and embed it on a different page (i.e. using the sidebar widget manager). You can, however, include those resources still by calling the appropriate URL generator method. It's a bit long winded but would be possible.

You can create HTML and PHP blocks, and naturally you can embed the two together (either using template logic in an HTML block, or regular PHP methods to output in a PHP block). It's worth noting one block can also embed another block. For instance

<h2>Title</h2>
{block="my_other_block"}

You could use this method to hide an environment variable in one block and then embed it in another block, although I'm not really confident this gains you much - if someone could access the first block in the AdminCP, they can access the other block as well.

Hopefully this helps!

Posted

Thanks bfarber, this is very useful. Would you mind providing me an example of what it would look like to call resources into a custom block via "URL generator" methods?

  • 1 month later...
Posted (edited)

@bfarber apologies for resurrecting an old thread - quick question.

On 12/8/2020 at 6:44 AM, bfarber said:


<h2>Title</h2>
{block="my_other_block"}

 

If in this example "my_other_block" is a php block which returns an array like below... how would I access the data from that array in the phtml block?

$exampleArray = Array(
  'foo' => 'bar',
  'baz' => Array(
		'nestedFoo' => 'nestedBar'
	)
);

 

Edited by LMX
Posted

you'd probably need to do something like this in your block

$_SESSION['arrayValues'] = ...;// The array data

and then look at $_SESSION['arrayValues'] in the rest of the block/template after. I just used $_SESSION as a globally accessible storage container in this case, you could use other similar paradigms.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...