using {php}{/php}, user defined tags, and global contents

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
kwansan
Forum Members
Forum Members
Posts: 35
Joined: Mon Apr 17, 2006 7:13 am

using {php}{/php}, user defined tags, and global contents

Post by kwansan »

Hi,

I have been away for a while.  I am working on a new project and I am having problems incorporating php with cmsmadesimple.  To use php I usually set a user defined tags and than add it as {my_userdefinedname} to my pages.  However, I am having a problem when what I needed call is a mixture of php and html.  It defeats the purpose of cms when I have to setup over 100 userdefined tags for each instance of php in my php/html form.  I know I can use the form modules but, the form I need is similar to a "job application form" it has about 25+ fields.  Plus it is posting to my db and sending an email confirmation to me and the applicant. 

With that being said, I have tried several ways.  I have setup a separate php page (which is a mix of php/html) and did a call from my cms page content as {php} include_once('pathtofile/form.php'); {/php} which did not work.  I have tried {literal} include_once('pathtofile/form.php'); {/literal} which did not work either.  It would either show nothing, show what I have typed.  I have tried setting up a user defined for includes and it does not call the page.  I have tried replacing each instance of in in my forms with {php} and {/php} which gives me a smarty error "line xxxx cannot recognize" etc etc.

Does anyone know the best way to call php pages that contain php/html.  Below is a snippet of what the form looks like so you will see an idea of my challenge of using this with cms.

==========================

Code: Select all

	<form action="#ffStart" method="post" enctype="multipart/form-data">
		<div class="FORMfields">
			<h1 class="FORMfields"><?= FF_FORM_TITLE ?></h1>
			<? if ($action == FF_DONE) { ?>
				<br />
				<div style="font: normal normal bold 18px verdana;">
					Thank you for your submission.
				</div>
				<div style="margin-top:20px;font: normal normal bold 12px verdana;">
					Note: Please click <a href="/">here</a> if your browser does not redirect in <?= SLEEP ?> seconds.
				</div>
				<br />
			<? } else {
				if ($action == FF_CONFIRM) {
					?>
						<h3 class="FORMfields">
							Please confirm that the following data is correct:
						</h3>
					<?
				} else {
					?>
						<div style="text-align:right;">
							<span class="required">*</span><span class="help" style="padding-left:0px;font-size:9px;"> - required</span>
						</div>
					<?
				}
				
				?>
				<?= $formBean->getIfError() ?>
				<table class="tableHelpers">
					<tr class="tableHelpersFormFields">
						<td class="tableHelpersFormFields1" ><div class="cell"><?= $formBean->getLabelTag("Name") ?></div></td>
						<td class="tableHelpersFormFields1" ><div class="cell"><?= $formBean->getFieldTag("Name") ?></div></td>
					</tr>
					<tr class="tableHelpersFormFields">
						<td class="tableHelpersFormFields2" ><div class="cell"><?= $formBean->getLabelTag("Email") ?></div></td>
						<td class="tableHelpersFormFields2" ><div class="cell"><?= $formBean->getFieldTag("Email") ?></div></td>
					</tr>
					<tr class="tableHelpersFormFields">
						<td class="tableHelpersFormFields1" ><div class="cell"><?= $formBean->getLabelTag("Phone") ?></div></td>
						<td class="tableHelpersFormFields1" ><div class="cell"><?= $formBean->getFieldTag("Phone") ?></div></td>
					</tr>
					<tr class="tableHelpersFormFields">
						<td class="tableHelpersFormFields2" ><div class="cell"><?= $formBean->getLabelTag("Street") ?></div></td>
						<td class="tableHelpersFormFields2" ><div class="cell"><?= $formBean->getFieldTag("Street") ?></div></td>
					</tr>
					<tr class="tableHelpersFormFields">
						<td class="tableHelpersFormFields1" ><div class="cell"><?= $formBean->getLabelTag("City") ?></div></td>
						<td class="tableHelpersFormFields1" ><div class="cell"><?= $formBean->getFieldTag("City") ?></div></td>
					</tr>
					<tr class="tableHelpersFormFields">
						<td class="tableHelpersFormFields2" ><div class="cell"><?= $formBean->getLabelTag("State") ?></div></td>
						<td class="tableHelpersFormFields2" ><div class="cell"><?= $formBean->getFieldTag("State") ?></div></td>
					</tr>
					<tr class="tableHelpersFormFields">
						<td class="tableHelpersFormFields1" ><div class="cell"><?= $formBean->getLabelTag("Zip") ?></div></td>
						<td class="tableHelpersFormFields1" ><div class="cell"><?= $formBean->getFieldTag("Zip") ?></div></td>
					</tr>
==========================
that is just a snippet to give you a visual.  Any suggestions? ??? .  Thanks in advance everyone.
kwansan
Forum Members
Forum Members
Posts: 35
Joined: Mon Apr 17, 2006 7:13 am

Re: using {php}{/php}, user defined tags, and global contents

Post by kwansan »

ok I figured out why the php was not working.  I had to turn it on in the config file.  So that problem is taken care of.  Now I can use {php}include('myphppage.php');{/php} into the template.  However, I have narrowed my problem down to this.

============
Fatal error: Call to a member function on a non-object in /home/www
============

I am not good with smarty tags, I think I have to include some function to be recognized by smarty tags within cmsmadesimple to eliminate that error.  Like include it in a global or something.  Unfortunately the form I need to use is using smart tags too.  hmmmm.  ??? ??? any ideas anyone ??  thanks!
kwansan
Forum Members
Forum Members
Posts: 35
Joined: Mon Apr 17, 2006 7:13 am

Re: using {php}{/php}, user defined tags, and global contents

Post by kwansan »

Ok I might be premature with my celebration but I was able to solve my problem by giving myself a crash course on tags.  I made my external php page as a tag and can now call it in cms made simple with with {tagname}.  I am not an expert with tag creations.  If any guru cares to chime in.  Please do.  I need to test it further to make sure there are no other problems and since its late I will leave it at that.  I will try to find a past post about tag creations or if someone who is more qualified wants to post something about tags.  :)
Post Reply

Return to “CMSMS Core”