Template customization

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
eudosia
User
Posts: 113

Template customization

Post by eudosia »

Hello. I need to customize the template. I need to start from 'template.php' file. I need a way to use conditional statements to exclude (or change) some html generation (table layout) in specific pages. For example I want to customize only the layout of login page.
AN example:
IF PHPMAKER IS GENERATING 'login page" then
<section class="container">
<section class="login-form">
<form method="post" action="" role="login">
<img src="assets/images/logo.png" class="img-responsive" alt="" />
<input type="email" name="email" placeholder="Email" required class="form-control input-lg" />
<input type="password" name="password" placeholder="Password" required class="form-control input-lg" />
<button type="submit" name="go" class="btn btn-lg btn-primary btn-block">Sign in</button>
<div>
<a href="#">Create account</a> or <a href="#">reset password</a>
</div>
</form>
<div class="form-links">
<a href="#">www.website.com</a>
</div>
</section>
</section>
ELSE
<!--##session menu##-->
<!-- content (begin) -->
<div id="ewContentTable" class="ewContentTable">
<div id="ewContentRow">
<div id="ewMenuColumn" class="<?php echo $gsMenuColumnClass ?>">

			<!-- left column (begin) -->
			<div class="ewMenu">

<!--##=SYSTEMFUNCTIONS.IncludeFile("menu","")##-->
</div>
<!-- left column (end) -->

		</div>

<!--##/session##-->
END IF

How can I do like that ?
THanks


danielc
User
Posts: 1601

Post by danielc »

To check for a page e.g. "Login", use:

<!--##
if (CTRL.CtrlID == "login") {
##-->
...
<!--##
}
##-->

<!--## ... ##--> is the template tag. Read Customizing Template in help file for more detail.


eudosia
User
Posts: 113

Post by eudosia »

Unfortunately
<!--##
if (CTRL.CtrlID != "login") {
##-->

seems not to work. It Seems like the IF statement is always TRUE.
I tried also if (CTRL.CtrlID == "login") { and It makes changes in ALL GENERATED PAGES....and this is not what I need.
Where I'm doing wrong ?
Thanks


mobhar
User
Posts: 11702

Post by mobhar »

Always post your code for more discussion.


danielc
User
Posts: 1601

Post by danielc »

<!--## ... ##--> is the template tag. Read Customizing Template in help file for more detail.

As said, this is a template tag to generate the code. If you want to generate some code in Login Page only, simply use:

<!--##session menu##-->
<?php if (CurrentPageID() == "login") { ?>
// your code
<?php } else { ?>
// else code
<?php } ?>
<!--##/session##-->


eudosia
User
Posts: 113

Post by eudosia »

Hi

How i will know the login system ie is it hard coded or using a table.
If its using a table for login then which table it is.

Is there any class or functions to check this ?


mobhar
User
Posts: 11702

Post by mobhar »

You may simply learn the "ewcfg.php" template file. See the following code:

// Security
define("EW_ADMIN_USER_NAME", "<!--##=ew_Quote2(PROJ.SecLoginID)##-->", TRUE); // Administrator user name
define("EW_ADMIN_PASSWORD", "<!--##=ew_Quote2(PROJ.SecPasswd)##-->", TRUE); // Administrator password

When those constants value are defined, then it means your web app uses hard-coded admin login.

In addition, still from that ewcfg.php template file, see this following code:

// User table filters
<!--##
if (bUserTable) {
...

That code means, system will check whether it uses user table or not.


Post Reply