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.


New Blocks

Login / Search

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

Well-settled

I can't seem to find a way to create new blocks.  I have searched through the documentation, but can't find anything definitive on this subject.

Your help, as always, is greatly appreciated.

Thanks.


ModelerX.com - Post your models in the gallery and chat about 'em in the forums.  Building the largest online community of modelers with your help.

Back to the top
 
Posted
Rating:
#30298
Avatar

The easiest way to create a new block named example is to create a sources_custom/miniblocks/example.php file. The file should contain ordinary PHP code (although it must be valid code, that doesn't produce any kind of PHP error during it's execution) that uses the echo command to generate it's output. The code may make use of all the ocPortal API.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#30313
Avatar

Well-settled

Ah ha!  I will try that out.

On a similar note, how do I resize blocks to be, say, a certian percentage of the page wide? 



ModelerX.com - Post your models in the gallery and chat about 'em in the forums.  Building the largest online community of modelers with your help.

Back to the top
 
Posted
Rating:
#30322
Avatar

Blocks don't have any predefined visual form - the form is purely determined by the XHTML that the block outputs (if any, even).


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#30367
Avatar

Well-settled

Maybe I asked the question incorrectly.  I noticed when I setup the site that image of the day and download of the day were next to each other above the news on the main page.  Well I cleared that out since I wasn't going to be using it, but didn't bother to copy the code that made it behave in that way.  Whoops.  :o  That's what I am going for here.


ModelerX.com - Post your models in the gallery and chat about 'em in the forums.  Building the largest online community of modelers with your help.

Back to the top
 
Posted
Rating:
#30369
Avatar

Ah right. If you look at the revision history for your start page, you should see an undated original file, that does a similar thing to what the Setup Wizard would have done.
Infact, the Setup Wizard's code is probably in the revision history somewhere too.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#30370
Avatar

Well-settled

Got it!  It's just inclosing the block in a DIV tag and changing the DIV properties to include the WIDTH property.  I should have thought of that myself.  LOL!

Now I just need to find out how to make a container that fits in with the theme of the site in my PHP code.  I have the content that I want, but I need to stick it in a pretty little box with a title above and a link below.


ModelerX.com - Post your models in the gallery and chat about 'em in the forums.  Building the largest online community of modelers with your help.

Back to the top
 
Posted
Rating:
#30371
Avatar

I believe this example miniblock code would work.

Code

$my_html='';
$my_html.='<p>My HTML</p>';
$box=put_in_standard_box($my_html,'My Title');
$box->evaluate_echo();

EDIT:

Actually, that's not really worthwhile. It would be easier just to output the block without a box, and then write some more Comcode around the block tag:

Code

[box="My Title"]
[block]my_block[/block]
[/box]


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#30372
Avatar

Well-settled

That's it, bud.  Thanks for the help.


ModelerX.com - Post your models in the gallery and chat about 'em in the forums.  Building the largest online community of modelers with your help.

Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: