Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Problems creating my own Template

Problems creating my own Template

Views: 1,754

Results 1 to 11 of 11
9 Feb 2026, 2:55 PM
#1
don_wagner avatar

don_wagner

New Zenner

Join Date:
Jan 2009
Location:
Iowa, USA
Posts:
65
Plugin Contributions:
0

Problems creating my own Template

I'm following the instructions in:

***Storeowner Docs / Template System / Creating your own Template ***

and:

***Storeowner Docs / Template System / Creating the template_info.php file


So, created the folder structure and copied Responsive *.css files as well as tpl_header.php and tpl_footer.php, and created the template_info file, including the line of code required for 2.1.0.

Then set my Template to the newly made one.

My Store is blank, unless I remove tpl_header.php from the new template.

Any insights would be deeply appreciated!!!!

9 Feb 2026, 7:50 PM
#2
don_wagner avatar

don_wagner

New Zenner

Join Date:
Jan 2009
Location:
Iowa, USA
Posts:
65
Plugin Contributions:
0

Re: Problems creating my own Template

Added this earlier but apparently I didn't properly comment the code:

Debug Log:

text/plain myDEBUG-20260208-184645-064063-warning.log ( ASCII text )
[08-Feb-2026 18:46:45 UTC] Request URI: /dev-2026/, IP address: 46.110.82.133, Language id 1
#0 /home/samad616/public_html/dev-2026/includes/templates/soldiers_custom/common/tpl_header.php(45): zen_debug_error_handler()
#1 /home/samad616/public_html/dev-2026/includes/templates/template_default/common/tpl_main_page.php(93): require('/home/samad616/...')
#2 /home/samad616/public_html/dev-2026/index.php(94): require('/home/samad616/...')
--> PHP Warning: Undefined variable $detect in /home/samad616/public_html/dev-2026/includes/templates/soldiers_custom/common/tpl_header.php on line 45.

[08-Feb-2026 18:46:45 UTC] PHP Fatal error: Uncaught Error: Call to a member function isMobile() on null in /home/samad616/public_html/dev-2026/includes/templates/soldiers_custom/common/tpl_header.php:45
Stack trace:
#0 /home/samad616/public_html/dev-2026/includes/templates/template_default/common/tpl_main_page.php(93): require()
#1 /home/samad616/public_html/dev-2026/index.php(94): require('/home/samad616/...')
#2 {main}
thrown in /home/samad616/public_html/dev-2026/includes/templates/soldiers_custom/common/tpl_header.php on line 45

[08-Feb-2026 18:46:45 UTC] Request URI: /dev-2026/, IP address: 46.110.82.133
--> PHP Fatal error: Uncaught Error: Call to a member function isMobile() on null in /home/samad616/public_html/dev-2026/includes/templates/soldiers_custom/common/tpl_header.php:45
Stack trace:
#0 /home/samad616/public_html/dev-2026/includes/templates/template_default/common/tpl_main_page.php(93): require()
#1 /home/samad616/public_html/dev-2026/index.php(94): require('/home/samad616/...')
#2 {main}
thrown in /home/samad616/public_html/dev-2026/includes/templates/soldiers_custom/common/tpl_header.php on line 45.

[08-Feb-2026 18:46:45 UTC] Request URI: /dev-2026/, IP address: 46.110.82.133
--> PHP Fatal error: Uncaught Error: Call to a member function isMobile() on null in /home/samad616/public_html/dev-2026/includes/templates/soldiers_custom/common/tpl_header.php:45
Stack trace:
#0 /home/samad616/public_html/dev-2026/includes/templates/template_default/common/tpl_main_page.php(93): require()
#1 /home/samad616/public_html/dev-2026/index.php(94): require('/home/samad616/...')
#2 {main}
thrown in /home/samad616/public_html/dev-2026/includes/templates/soldiers_custom/common/tpl_header.php on line 45.

tpl_header.php starting at line 44:

<?php
 if ( $detect->isMobile() && !$detect->isTablet() || $_SESSION['layoutType'] == 'mobile' ) {
echo '<div class="header Fixed"><a href="#menu" title="Menu"><i class="fa-solid fa-bars"></i></a></div>';
 } else if ( $detect->isTablet() || $_SESSION['layoutType'] == 'tablet' ){
echo '<div class="header Fixed"><a href="#menu" title="Menu"><i class="fa-solid fa-bars"></i></a></div>';
} else {
//
}
9 Feb 2026, 7:53 PM
#3
don_wagner avatar

don_wagner

New Zenner

Join Date:
Jan 2009
Location:
Iowa, USA
Posts:
65
Plugin Contributions:
0

Re: Problems creating my own Template

Added this earlier but apparently I didn't properly comment the code:

Debug Log:

text/plain myDEBUG-20260208-184645-064063-warning.log ( ASCII text )
[08-Feb-2026 18:46:45 UTC] Request URI: /dev-2026/, IP address: 46.110.82.133, Language id 1
#0 /home/samad616/public_html/dev-2026/includes/templates/soldiers_custom/common/tpl_header.php(45): zen_debug_error_handler()
#1 /home/samad616/public_html/dev-2026/includes/templates/template_default/common/tpl_main_page.php(93): require('/home/samad616/...')
#2 /home/samad616/public_html/dev-2026/index.php(94): require('/home/samad616/...')
--> PHP Warning: Undefined variable $detect in /home/samad616/public_html/dev-2026/includes/templates/soldiers_custom/common/tpl_header.php on line 45.

[08-Feb-2026 18:46:45 UTC] PHP Fatal error:  Uncaught Error: Call to a member function isMobile() on null in /home/samad616/public_html/dev-2026/includes/templates/soldiers_custom/common/tpl_header.php:45
Stack trace:
#0 /home/samad616/public_html/dev-2026/includes/templates/template_default/common/tpl_main_page.php(93): require()
#1 /home/samad616/public_html/dev-2026/index.php(94): require('/home/samad616/...')
#2 {main}
  thrown in /home/samad616/public_html/dev-2026/includes/templates/soldiers_custom/common/tpl_header.php on line 45

[08-Feb-2026 18:46:45 UTC] Request URI: /dev-2026/, IP address: 46.110.82.133
--> PHP Fatal error: Uncaught Error: Call to a member function isMobile() on null in /home/samad616/public_html/dev-2026/includes/templates/soldiers_custom/common/tpl_header.php:45
Stack trace:
#0 /home/samad616/public_html/dev-2026/includes/templates/template_default/common/tpl_main_page.php(93): require()
#1 /home/samad616/public_html/dev-2026/index.php(94): require('/home/samad616/...')
#2 {main}
  thrown in /home/samad616/public_html/dev-2026/includes/templates/soldiers_custom/common/tpl_header.php on line 45.

[08-Feb-2026 18:46:45 UTC] Request URI: /dev-2026/, IP address: 46.110.82.133
--> PHP Fatal error: Uncaught Error: Call to a member function isMobile() on null in /home/samad616/public_html/dev-2026/includes/templates/soldiers_custom/common/tpl_header.php:45
Stack trace:
#0 /home/samad616/public_html/dev-2026/includes/templates/template_default/common/tpl_main_page.php(93): require()
#1 /home/samad616/public_html/dev-2026/index.php(94): require('/home/samad616/...')
#2 {main}
  thrown in /home/samad616/public_html/dev-2026/includes/templates/soldiers_custom/common/tpl_header.php on line 45.

tpl_header.php starting at line 44:

<?php
 if ( $detect->isMobile() && !$detect->isTablet() || $_SESSION['layoutType'] == 'mobile' ) {
echo '<div class="header Fixed"><a href="#menu" title="Menu"><i class="fa-solid fa-bars"></i></a></div>';
 } else if ( $detect->isTablet() || $_SESSION['layoutType'] == 'tablet' ){
echo '<div class="header Fixed"><a href="#menu" title="Menu"><i class="fa-solid fa-bars"></i></a></div>';
} else {
//
}
9 Feb 2026, 7:58 PM
#4
don_wagner avatar

don_wagner

New Zenner

Join Date:
Jan 2009
Location:
Iowa, USA
Posts:
65
Plugin Contributions:
0

Re: Problems creating my own Template

Tried posting the debug log but not working so posting a screenshot of it:

Attachment 21164

9 Feb 2026, 8:46 PM
#5
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,717
Plugin Contributions:
56

Re: Problems creating my own Template

You're not creating an instance of the MobileDetect class.

See includes/templates/responsive_classic/common/main_template_vars.php

lines 36-39 in 2.1.0.

Having said that ... creating a new template is a HUGE job. You'd be better off starting the the Responsive Classic Redesign and tweaking to taste.

https://docs.zen-cart.com/user/template/responsive_classic_redesign/

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

9 Feb 2026, 9:01 PM
#6
don_wagner avatar

don_wagner

New Zenner

Join Date:
Jan 2009
Location:
Iowa, USA
Posts:
65
Plugin Contributions:
0

Re: Problems creating my own Template

Thanks SWGUY - I wasn't even aware of this template. Will get right on it.

BTW - I may have many more questions as time goes by.

9 Feb 2026, 9:36 PM
#7
don_wagner avatar

don_wagner

New Zenner

Join Date:
Jan 2009
Location:
Iowa, USA
Posts:
65
Plugin Contributions:
0

Re: Problems creating my own Template

Sorry but I'm easily confused, and have changed direction several times during this move to 2.1.0.

Responsive Classic Redesign and Responsive Classic are the same? "Creating your own Template" instructions for customizing Responsive Classic are not accurate? So should I make style changes directly in the Responsive Classic template?

Trying to get on true bearing here before moving forward.

9 Feb 2026, 9:58 PM
#8
don_wagner avatar

don_wagner

New Zenner

Join Date:
Jan 2009
Location:
Iowa, USA
Posts:
65
Plugin Contributions:
0

Re: Problems creating my own Template

Okay it's starting to soak in. I'm just so enthusiastic about upgrading that I'm tripping over my own feet at every turn.

Please try to bear with me.

9 Feb 2026, 10:54 PM
#9
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,717
Plugin Contributions:
56

Re: Problems creating my own Template

Upgrading is good and enthusiastic is good! So, double good. :).

You may not be aware that there's another template called Bootstrap which is also available and might be a good starting point for you:

https://docs.zen-cart.com/user/template/bootstrap/

That Software Guy. My Store: Zen Cart Support
Available for hire - See my ad in Services
Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
Do you benefit from Zen Cart? Then please support the project.

9 Feb 2026, 11:59 PM
#10
dbltoe avatar

dbltoe

Totally Zenned

Join Date:
Jan 2004
Location:
N of San Antonio TX
Posts:
9,843
Plugin Contributions:
17

Re: Problems creating my own Template

Regardless of which template you choose to manipulate to your liking, I would suggest you use the clone a template mod before you start changing things.

You'll always have a test/base template to fall back on when things go bump in the night.

Need a hand with Zen Cart? Hire the team at myZenCartZone.com for upgrades, repairs, and custom plugins.
Zen Cart Certified hosting at myZenCartHost.com

12 Feb 2026, 1:03 PM
#11
don_wagner avatar

don_wagner

New Zenner

Join Date:
Jan 2009
Location:
Iowa, USA
Posts:
65
Plugin Contributions:
0

Re: Problems creating my own Template

Thanks! Was unaware of that plugin.