Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

Forums / Cotonti / Support / How to Make new Theme

12>>>

n0fx
#1 2016-10-24 23:52

Hi everyone,

I am still using seditio old version. I converted my database to cotonti siena what was important for me. Then I want to make new theme for my website.

I prepared my HTML files. First I was thinking I can use nemesis theme for reference theme but for example there is no forum tpl files in the folder. Then I found tpl files on the modules/forums but I also found tpl files (forum) on the symisun-03 theme folder. So I am confused now How I can start to make new theme ? Someone can guide me?  I also need clean and well coded theme for reference.

Thanks a lot.

 


This post was edited by n0fx (2016-10-25 00:01, 5 years ago)
Macik
#2 2016-10-25 06:21

Yes, Nemesis theme is simple enought to start from. But as you mentioned it had not self-tuned tpl for some Extensions. 

It's OK to use Nemesis as reference and add default TPL from Extensions folders. I do not recommend to use Symisun as its quite outdated.

A secong variant is to use more complete (but simple enough) themes like Skeletonti or Clymene.
 

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F
n0fx
#3 2016-10-25 19:06

Thank you for answer :) I look skeletonti and clymene. I still think nemesis is good start point for reference theme. I want to understand How is working template system because when I add forum tpl files in the root theme folder its working but I also just add forum tpl files in themefolder/modules its working too.. So This template system just can look tpl file name on the theme folder even I added different folder on the theme folder?

 

I want to ask because I can make own folder structure ? :)

Macik
#4 2016-10-25 20:43

To be exact — template loading function is flexible and search for several places TPL file may exists.

For example of `coolplug` Plugin and its default template `coolplug.tpl` this chain would be:

  • `themes/mytheme/plugins/coolplug/coolplug.tpl
  • `themes/mytheme/plugins/coolplug.tpl
  • `themes/mytheme/coolplug.tpl

(Same rules for Modules and `modules` folder respectively)

If you have many Extensions templates in your theme, it's more clear to place it in separate folders.

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F
n0fx
#5 2016-10-25 20:56

Nice :) If there is no problem, I want to ask question about process of new theme on this topic. This topic also can guide who want to make new theme.

There is a list about default common, modules and plugin tpl tags? // I found https://www.cotonti.com/tpltags

Added 3 days later:

Hi, I am using v0.9.19. When I try to use search plugin, there is a error like "You're not allowed to do this.". Then I try to enter "Rights" of Search plugin but there is a also error like "One of the request parameters is invalid or has expired. Please go back and try submitting the form again."

Whats the problem? Do you have a idea? 

I looked issue on the cotonti github page but I couldnt find about it because search plugin doesnt work on this website too.


This post was edited by n0fx (2016-10-29 01:33, 5 years ago)
Macik
#6 2016-10-29 21:07
#42239 n0fx:

There is a list about default common, modules and plugin tpl tags? // I found https://www.cotonti.com/tpltags

To simplify developing TPL of certain pages — you can eneble list available tags and blocks.

Added 3 days later:

Hi, I am using v0.9.19. When I try to use search plugin, there is a error like "You're not allowed to do this.". Then I try to enter "Rights" of Search plugin but there is a also error like "One of the request parameters is invalid or has expired. Please go back and try submitting the form again."

Whats the problem? Do you have a idea? 

I looked issue on the cotonti github page but I couldnt find about it because search plugin doesnt work on this website too.

Seems security check of form data is failed (it used by core for POST forms).

What way you are use `Search` plugnin? I mean what form, what method of form data sending (get/post) and what address you send this data?

Try to see default nemesis theme for search form (in `footer.tpl`).

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F
n0fx
#7 2016-10-30 15:07
#42264 Macik:
#42239 n0fx:

There is a list about default common, modules and plugin tpl tags? // I found https://www.cotonti.com/tpltags

To simplify developing TPL of certain pages — you can eneble list available tags and blocks.

Added 3 days later:

Hi, I am using v0.9.19. When I try to use search plugin, there is a error like "You're not allowed to do this.". Then I try to enter "Rights" of Search plugin but there is a also error like "One of the request parameters is invalid or has expired. Please go back and try submitting the form again."

Whats the problem? Do you have a idea? 

I looked issue on the cotonti github page but I couldnt find about it because search plugin doesnt work on this website too.

Seems security check of form data is failed (it used by core for POST forms).

What way you are use `Search` plugnin? I mean what form, what method of form data sending (get/post) and what address you send this data?

Try to see default nemesis theme for search form (in `footer.tpl`).

I didnt try to send data via POST Actually I just try to enter index.php?e=search and I got error #930 access denied thats why I was trying to enter rights page about search plugin (admin.php?m=rightsbyitem&ic=plug&io=search) then there is a again error "One of the request parameters is invalid or has expired. Please go back and try submitting the form again." 

I want to say also I upgrade seditio v123 to cotonti v0.9.19 maybe its related about it ?

note: I got same error when I use search plugin on the nemesis theme :(

Macik
#8 2016-10-30 15:54

So, you get this error even open a plugin page `index.php?e=search`?  

If so — no idea yet. It can be some rights inconsistency, but needs to be investigated in details.

First, try to uninstall it completedly and then reinstall.

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F
n0fx
#9 2016-10-30 16:02

I did reinstall, its working now, thank you :) actually I didnt expect its related reinstall :)

Added 5 hours later:

Some of plugins are not working with 0.9.19. I made list and I will update this list. I also wrote comment why its not working.


https://www.cotonti.com/extensions/files-media/pageavatar-siena (Solved: you can look to comment on the page)

If you want to optimize images expect thumb images. you should add these codes:
pageavatar.page.add.done.php (line 49)
 

$info = getimagesize($filename);
 if ($info['mime'] == 'image/jpeg') {$image = imagecreatefromjpeg($filename);
 imagejpeg($image, $filename, 85);
 }
elseif ($info['mime'] == 'image/gif') {$image = imagecreatefromgif($filename);
imagegif($image, $filename, 85);
}
elseif ($info['mime'] == 'image/png') {$image = imagecreatefrompng($filename);
imagepng($image, $filename, 85);
}


https://www.cotonti.com/extensions/files-media/612

Added 1 day later:

Hi,

I need to use </div> 1 time in the PAGE_ROW. How can i get data how many times loop in the PAGE_ROW like while $i variable ?  I hope I could explain myself.

I found {PAGE_ROW_NUM}

Added 4 days later:

how i can change pagination html tags ?


This post was edited by n0fx (2016-11-05 00:59, 5 years ago)
Macik
#10 2016-11-05 22:24
#42271 n0fx:

I need to use </div> 1 time in the PAGE_ROW. How can i get data how many times loop in the PAGE_ROW like while $i variable ?  I hope I could explain myself.

I found {PAGE_ROW_NUM}

What extension / section / template you are edit?

Added 4 days later:

how i can change pagination html tags ?

Look at `system/resources.rc.php` → «Pagination» section. You can redefine this variables in your `theme_name.php` file.

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F
n0fx
#11 2016-11-07 14:08
#42293 Macik:
#42271 n0fx:

I need to use </div> 1 time in the PAGE_ROW. How can i get data how many times loop in the PAGE_ROW like while $i variable ?  I hope I could explain myself.

I found {PAGE_ROW_NUM}

What extension / section / template you are edit?

I used for news plugin

Added 4 days later:

how i can change pagination html tags ?

Look at `system/resources.rc.php` → «Pagination» section. You can redefine this variables in your `theme_name.php` file.

This is very good but I also need to change <p class="paging"> ? Actually I want to change to <ul> <li>

Macik
#12 2016-11-08 08:53
#42302 n0fx:

 found {PAGE_ROW_NUM}

What extension / section / template you are edit?

I used for news plugin

Yes, you can use {PAGE_ROW_NUM}. (Or with direct variable access — {PHP.jj})

how i can change pagination html tags ?

Look at `system/resources.rc.php` → «Pagination» section. You can redefine this variables in your `theme_name.php` file.

This is very good but I also need to change <p class="paging"> ? Actually I want to change to <ul> <li>

Unfortunately, `<p>` wrapper is hard coded in many templates. So to fully change it you need to rearrange whole template.

But you can use a little «hackaround» — add wrapper to `$R['link_pagenav_first']` and `$R['link_pagenav_last']` as listed below (… denotes other paging related code):

$R['link_pagenav_first'] = '</p><ul class="mypaging">…';
$R['link_pagenav_last'] = '…</ul><p class="paging">';

So final rendered HTML whould be:

<p class="paging"></p>
  <ul class="mypaging">
    …you pager code…
  </ul>
<p class="paging"></p>

So just add `p.paging{display:none;}` to your CSS to eliminate unnecessary paragraphs.

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F
n0fx
#13 2016-11-09 20:59
#42304 Macik:
#42302 n0fx:

 found {PAGE_ROW_NUM}

What extension / section / template you are edit?

I used for news plugin

Yes, you can use {PAGE_ROW_NUM}. (Or with direct variable access — {PHP.jj})

Its very good I can use also for different variables :)

how i can change pagination html tags ?

Look at `system/resources.rc.php` → «Pagination» section. You can redefine this variables in your `theme_name.php` file.

This is very good but I also need to change <p class="paging"> ? Actually I want to change to <ul> <li>

Unfortunately, `<p>` wrapper is hard coded in many templates. So to fully change it you need to rearrange whole template.

But you can use a little «hackaround» — add wrapper to `$R['link_pagenav_first']` and `$R['link_pagenav_last']` as listed below (… denotes other paging related code):

$R['link_pagenav_first'] = '</p><ul class="mypaging">…';
$R['link_pagenav_last'] = '…</ul><p class="paging">';

So final rendered HTML whould be:

<p class="paging"></p>
  <ul class="mypaging">
    …you pager code…
  </ul>
<p class="paging"></p>

So just add `p.paging{display:none;}` to your CSS to eliminate unnecessary paragraphs.

This is good idea but  If you are at the first page system dont show {FORUMS_TOPICS_PAGEPREV} thats why its not working. 
I solved like this I changed system/functions.php 4062 line
 

if ($current > 0)

to

if ($current > -1)

and line 4114

if (($current + $perpage) < $entries)

to

if ($entries)


 

Added 5 hours later:

{LIST_ROWCAT_COUNT} always show 0 even I looked last element of category structure. It should show how many pages under the category? How i can solve it? 

Note: I am working with my old database (converted last cotonti version from seditio). When I added page, I can see 1 but it doesnt count my old pages.


This post was edited by n0fx (2016-11-11 01:46, 5 years ago)
Macik
#14 2016-11-12 02:19
#42319 n0fx:

{LIST_ROWCAT_COUNT} always show 0 even I looked last element of category structure. It should show how many pages under the category? How i can solve it? 

Note: I am working with my old database (converted last cotonti version from seditio). When I added page, I can see 1 but it doesnt count my old pages.

First try this: go to «Administration» → «Structure» → «Pages» and click «Resync».

https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F
n0fx
#15 2016-11-12 14:48

Unfortunately it doesnt work :(

NOTE: I was using SED_DEBUG from config.php. When I am seaching why SESSION isnt exists, I changed SED_DEBUG mode to FALSE so its working now. Weird i didnt know its related SED_DEBUG sorry.

Added 21 hours later:

Hi,

I want to use recent items plugin for page.tpl. I researched but I couldn't find a way for it. How i can do it? 

Many thanks :)


This post was edited by n0fx (2016-11-13 14:21, 5 years ago)

12>>>