Forums / Cotonti / Support / Simple Question

blocks and links navigation?

eksplode
#1 2013-01-05 18:55

Hello,

I don't know if I'm just blind or what, but I can't find one thing. How can I manage blocks in Cotonti? On the right side of my website (using nemesis theme) I have default blocks:

*Admin

*Polls

*Tags

*Online

Where can I manage it? move them up o down, delete and create new ones (you know what I mean). I can't find it anywhere in administration panel.

Also, I can't manage top main navigation. I have *Home *Forums *News *RSS *Search and I don't know how to delete them or add new ones.

I'm far from professional web developer so please forgive me for this question :)

Thank you.

Twiebie
#2 2013-01-05 19:20

Hi eksplode,

You can manage these blocks in the .tpl files of your website.

For example if you want to remove the polls on the index, open index.tpl in your theme folder (themes/nemesis/index.tpl)

Find the block:

<!-- IF {INDEX_POLLS} -->
<div class="block">
    <h2 class="polls">{PHP.L.Polls}</h2>
    {INDEX_POLLS}
</div>
<!-- ENDIF -->

You can then simply remove it, change it, style it, etc.

The top main navigation is in the header.tpl file. Just open the file and look for:

	<ul id="nav" class="body">
		<li>
			<a href="{PHP.cfg.mainurl}" title="{PHP.L.Home}">
				{PHP.L.Home}
				<span>Start here</span>
			</a>
		</li>
		<!-- IF {PHP.cot_modules.forums} -->
		<li>
			<a href="{PHP|cot_url('forums')}" title="{PHP.L.Forums}">
				{PHP.L.Forums}
				<span>Discussions</span>
			</a>
		</li>
		<!-- ENDIF -->
		<li>
			<a href="{PHP|cot_url('page','c=news')}" title="{PHP.L.News}">
				{PHP.L.News}
				<span>Our updates</span>
			</a>
		</li>
		<!-- IF {PHP.cot_modules.rss} -->
		<li>
			<a href="{PHP|cot_url('rss')}" title="{PHP.L.RSS_Feeds}">
				RSS
				<span>Subscribe me</span>
			</a>
		</li>
		<!-- ENDIF -->
	</ul>

Here is some more information:

http://www.cotonti.com/docs/ext/themes/rendering_overview

 

This post was edited by Twiebie (2013-01-05 21:43, 11 years ago)
eksplode
#3 2013-01-05 19:30

Thanks! That's exactly what I was looking for :)

Twiebie
#4 2013-01-05 19:33

Glad I could help! ;)

eksplode
#5 2013-01-05 20:56

Ok, one more question which is beyond my knowledge. I created a block between "Administrator" and "Polls" in index.tpl. Code looks like this:

<div class="block">
                <h2 class="navigation">{PHP.L.Navigation}</h2>
                <ul class="bullets">
                    <li><a href="test">TEST </a></li>
                    <li><a href="google.com">GOOGLE</a></li>
                </ul>
            </div>

Added some style in decault.css

The problem is that this block is only visible while logged in with administrator account. What am I missing here?

 

Kingsley
#6 2013-01-05 21:16

You have probably put the block right under the admin black, and before

    <!-- ENDIF -->
    <!-- IF {INDEX_POLLS} -->

place your block after the <!-- ENDIF --> but before the <!-- IF {INDEX_POLLS} -->

 

Everything put between the statement below is concidered te be for the administrator's eyes only. A user of visitor , whcich have lesser rights than you can't see what's in between.

<!-- IF {PHP.usr.isadmin} -->

put content here

  <!-- ENDIF -->

another example is this one:

   
    <!-- IF {INDEX_POLLS} -->

     {INDEX_POLLS}

    <!-- ENDIF -->

This statement tells the system that if  there is a poll that the block mush be shown, otherwise the content between the open and close statement will not be visible.

 

Here is a link that tells you more on this subject: http://www.cotonti.com/docs/ext/themes/cotemplate_advanced

eksplode
#7 2013-01-05 21:28

Thanks, you were right. I have some basic html and css knowledge, but I don't know anything in php and tpl. That's why I'm having difficulties. Is there a reason why there's no block manager in admin panel like in most of cms? This makes it a bit of pain for unexperienced user like me. :)

Anyway, I should be good on my own from now :)

Twiebie
#8 2013-01-05 21:33

To be honest I'm not sure why there's no such feature, but on the other hand the way it is now provides the developer with a system that is fully customizable. With some basic HTML/CSS knowledge you'll find yourself get the hang of it quite quickly and see the possibilities.

Personally I never really liked the feature that you can change the blocks in the admin panel on some CMS's. Most of the time you end up wanting to customize them in the template anyway.

With Cotonti you can basically drop any .TPL file in your theme folder and customize it to your needs.

Kingsley
#9 2013-01-06 01:04
#36700 eksplode:

I have some basic html and css knowledge, but I don't know anything in php and tpl.

I too only have html/css knowledge. Just get to know Cotonti for a bit, and you'll see just how manageble it all is.

The tpl's are simply the files you put you're html in, most modules/plugins have a default tpl folder containing the default working template.

Copy those files to your /theme folder and edit them to you're likings. Cotonti will automatically use the tpl file in your theme folder over the default one.

(copy module tpl to your /theme folder and those of plugins to /theme/plugins)

all the tpl files (combined with some basic tpl file rules ofcourse) make your website theme. Imho the biggest plus side of this system is that is gives webdesigners a very high level of control on how and where content is displayed.

 

eksplode
#10 2013-01-07 14:24

Hello again guys,

I'm here with a SERIOUS question :) So, I'm getting used to cotonti little by little, but I still don't quite understand  the tpl feature.

I have my navigation block with my pages (articles) on the home page. The problem is that this block is only visible on the home page. I need my navigation on pages as well. What kind of "IF" do I need to define in order for blocks to appear in my pages? I tried to read the link that Kingsley provided above, but it contains only general information such as logical operators, etc. I need to know specifically.

Thank you. :)

Twiebie
#11 2013-01-07 14:29

Put the navigation in header.tpl instead of index.tpl.

index.tpl is only shown on... the index. :)

header.tpl and footer.tpl are displayed on every page, and page content is shown in the middle (where normally index.tpl is).

Hope that helps!

lukgoh
#12 2013-01-07 16:51

Also in the administration section of your Cotonti website you will see a link to "Menu slots in tpl-files" somewhere like: www.yourdomain.com/admin.php?m=config&n=edit&o=core&p=menus and you can set your links there. Then you only need to include a {TAG}  in the header or footer tpls. 

For example, if you use the Menu slot #1 which I recommend, you would set your html links in the value box and then use the tag {PHP.cfg.menu1} which will work in any tpl. 

 I still don't quite understand  the tpl feature

One of the reasons Cotonti is so awesome is because it keeps all the PHP (logic) seperate from the HTML and styles using a very smart templating system. The template system uses TPL files to build its template. You will see you have a tpl file for each part of the website, header, footer, index and so on. This way you are never tied to certain html or styles because they are not hard coded in with the logic (PHP). 

The most important thing to remember, as Twiebie said: Your header and footer is always displayed. Only the middle bit changes depending on the page for example:

Header.tpl

Index.tpl or Page.tpl or Users.tpl etc.

Footer.tpl

Luke.