HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Adding simple stand-alone php code as a block

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#71539 (In Topic #15055)
Avatar

Well-settled

We're trying to integrate a module which is stand-alone (i.e. it does not reqiure anything from OcPortal to work). It is available as a hardcoded URL now at Gamble calculator
Though we would really prefer to add it as a block/minimodule so we could use it as a page content in when building OcPortal pages.
It seems our php knowledge is not enough to have OcPortal recognize this code as a "native" - it seems that it is required to create a class and then pass something to the core structure that makes an output. But we get troubles determining the API structures we need to create|pass over. Is there any simple documentation about blocks and core template structure for lamers? :) The file I am talking about does all the work by itself and we can create necessary variables but I am not sure how should we pass final data to the OcPortal template to display (or, even better, just handle the output without styles letting OcPortal take care of them)?
I have tried to create a new block but it refuses to work with various errors (no class, or absent data when we create a class and many others).


Last edit: by raven
Back to the top
 
Posted
Rating:
#71540
Avatar

Community saint

Hi raven, try making a "miniblock". This can be done easily by dumping raw, non-ocPortal PHP into a file in sources_custom/miniblocks, that gives all of its output via PHP's usual means (eg. echo). I've written some n00b-friendly tutorials in the community documentation Creating Miniblocks from Third-Party Code - ocPortal (note that these assume no programming knowledge, so may be a little tedious in places for someone who already knows how to program)
Back to the top
 
Posted
Rating:
#71541
Avatar

Well-settled

That's it! Thank you Chris :thumbs: There is still few work of making it looking better but it works native now :)
You're really amazing :thumbs:
Back to the top
 
Posted
Rating:
#72234
Avatar

Well-settled

Yes he is =)
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: