Help with Joomla params

For Joomla! 3.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Locked
Giorgi_964758
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Mon Mar 27, 2017 5:05 pm

Help with Joomla params

Post by Giorgi_964758 » Wed Nov 15, 2017 7:08 am

Hi ! I'm doing template on Joomla 3.7. I'm reading Dan Rahmel - Advanced Joomla. And I met the problem. I don't understand what I'm doing wrong. I'm creating a param (for Inject jQuery library reference into head section) in templateDetail.xml file in sublime text 3.

Code: Select all

<config>
				<fields name="params">
					<fieldset name="advanced">
						<field name="include_jquery" type="radio"
							default="1" label="Include jQuery"
							description="Inject jQuery library reference into head section">
							<option value="1">Yes</option>
							<option value="0">No</option>
						  <?php if($this->params->get('include_jquery')): ?>
							<script type="text/javascript"
						  	  src="<?php echo $template_path;?>/js/jquery-3.2.1.min.js"></script>
						  <?php endif;?>
						</field>

						<field name="background_color" type="text" default="white"
							label="Background color"
							description="Set the background color of the body tag"
							filter="string" />
					</fieldset>
				</fields>
			</config>



PHP tag colored in red. Why ? Please see the picture

Image
Last edited by imanickam on Wed Nov 15, 2017 8:52 am, edited 1 time in total.
Reason: Moved the topic from the forum Templates for Joomla! 3.x to the forum Joomla! 3.x Coding

Morissius
Joomla! Apprentice
Joomla! Apprentice
Posts: 22
Joined: Tue Oct 31, 2017 7:41 pm

Re: Help with Joomla params

Post by Morissius » Wed Nov 15, 2017 10:11 am

You are using php in an .xml file. I am pretty sure that's not allowed.

Giorgi_964758
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Mon Mar 27, 2017 5:05 pm

Re: Help with Joomla params

Post by Giorgi_964758 » Wed Nov 15, 2017 10:33 am

Attached fragment from the book

Image
Image

User avatar
effrit
Joomla! Guru
Joomla! Guru
Posts: 846
Joined: Sun Nov 12, 2017 2:21 pm
Location: middle of Russia
Contact:

Re: Help with Joomla params

Post by effrit » Wed Nov 15, 2017 10:43 am

you are mixed 2 different files.
first part was about xml (no js/php allowed), second - its template index.php

Giorgi_964758
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Mon Mar 27, 2017 5:05 pm

Re: Help with Joomla params

Post by Giorgi_964758 » Wed Nov 15, 2017 11:01 am

Many thanks for help !

User avatar
effrit
Joomla! Guru
Joomla! Guru
Posts: 846
Joined: Sun Nov 12, 2017 2:21 pm
Location: middle of Russia
Contact:

Re: Help with Joomla params

Post by effrit » Wed Nov 15, 2017 11:06 am

Yes. From "Figure 3-10" is about how to show params in index.php of template.

Giorgi_964758
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 104
Joined: Mon Mar 27, 2017 5:05 pm

Re: Help with Joomla params

Post by Giorgi_964758 » Wed Nov 15, 2017 11:08 am

Many thanks for help !


Locked

Return to “Joomla! 3.x Coding”