Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Content Modules - print anywhere


Recommended Posts

If we want to have content easy to modify on pages or page with option to turning off, we can use Content Module system for it and call only One of the box which we want and print it in our Template where we want.


We can do through this steps:


Create new directory: includes/modules/content/everywhere/


In template_top.php

Before or just after:



  if ($oscTemplate->hasContent('everywhere')) {

In osc_template.php

Add (before getContent method)

    function getOneContent($title){
      return $this->_content['everywhere'][$title];


    function addContent($content, $group, $contentname = false) {
        $this->_content[$group][$contentname] = $content;
        $this->_content[$group][] = $content;

And when you creating new module content in execute funtion do it like that:

$oscTemplate->addContent($template, $this->group, $this->title);

After all of this it's possible to print content where we want like that:

echo $oscTemplate->getOneContent('Custom info');
Edited by slupostrupek
Link to comment
Share on other sites

i can't edit. But as a second thought this 'everywhere' idea is a little bad, it's good if the Module will be displied on every page (footer / header).


But still giving names in array are giving opportunity to place module not in one direction/place like a list, but it can be displayed on page where we want. Let's say, we want modul at the beggining of the page like index.php but the second modul at the end, and this will give us all power of getOneContent.



So it should changed name 'everywhere' in to footerAndheader, so that people began to not use it in a bad way

Edited by slupostrupek
Link to comment
Share on other sites

I will try to make it more clearier.


Right now, files will lost they template information, becaus of content modules. 


Content modules are right now, lists. They are followed by sort order. So if we want to add something in our login.php <- we need to make correct CSS for our previous content and for the next content module.


In my way of point of view. We will creating easier Theme by making it only in login.php or other specific php files defined in content modules, and there will be 'grounded' classes, where we will be adding into them right modules.


So now it looks like that on example of product_info.php.

- sort order 10 = Image box

- sort order 20 = Name

- sort order 30 = Buy Now

- sort order 40 = Description

whole design class need to be in those modules. Becaus it goes through that specific sort and also, if we would like to change sort, it also can destroy whole design if those div classes want be as like normal 'floats' or tables styles and all we know it, they want be like that!! Those modules will have to have special divs for template reasons.... and that is making unclear for changes.


Instead of making sort order, there should be this modification allowing to make it like that:

product_info.php instead of one while until list will go over it will have something like this:

- div for image

- div for right column where would goes name, button, model

- div for description, comments, reviews

and now, every developer nows, if want to change design he will edit those 3 divs in product_info, not in content modules and their sort order.

and will do that:

- div for image (echo getOneContent('enhancedColorBox')

- div for right column( echo getOneContent('name') . 'div class model ' . getOneContent('model') . ' div class underAddToCart '.  getOneContent('socialButtons'))

and others...

maybe it will have more echos, but still it will easier to manage template. Also we can provide more option for this, like adding params for getOneContent so not only title but also provde class name, 

Link to comment
Share on other sites

it is starting to make sense , some sense, not quite sensible yet imho

it only makes sense to me if you talk about content blocks that you want in different places, perhaps your example is badly choosen ?


I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!


Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...