PHP template help
Posted on
16th Feb 2014 07:03 pm by
admin
Ok, I don't know if anyone can help me but I am using PHP templates to make a site. I am a newbie and so I am finding this quite difficult so I thought I would ask some folks much better than me.
I have two pages at work here; profile.tpl and profile.php.
The profile page has <Zone> tags in it. I am attempting to pulll a list of contacts from the database and display the picture and user information. This part works fine.
The part I am having trouble with is displaying a different zone if there are no users to associated with the current profile.
I am using a if statement to do this (I did not write this if statement so forgive my ignorance about how it works) and I want an else to take place if there is no contacts that will display an alternative zone.
This is the code from the profile template page:
<ZONE contactsTab enabled>
<div class="dashContent">
<LOOP contactEntity>
<div style="float:left;">
<a href="?L=users.profile&id={contact.id}">
<img src="system/image.php?file={contact.mainpicture}" alt="[Picture {150}]" hspace="2" border="0" id="picture" /></a>
<br />
<a href="?L=users.profile&id={contact.id}">{contact.username}</a></div>
</LOOP contactEntity>
<ZONE addtocontactstab enabled>
<a href="?L=contacts.adduser&id={user.id}">[Add {user.username} to my contacts list {8225}]</a>
</ZONE addtocontactstab enabled>
<div class="clear"></div>
</div>
</ZONE contactsTab enabled>
<ZONE contacts disabled>
<div>This user does not have any contacts at this time.</div>
</ZONE>
This is the code from the supporting PHP page:
$userContactsArray = unpk(_fnc("user", $_GET["id"], "contacts"));
$i=0;
if (is_array($userContactsArray)) foreach($userContactsArray as $userContactGroup => $contactsUsersArray) {
if (is_array($contactsUsersArray)) foreach($contactsUsersArray as $contactsUserID) {
$thirdUserContactsArray = unpk(_fnc("user", $contactsUserID, "contacts"));
if (is_array($thirdUserContactsArray) && _fnc("in_multiarray", $thirdUserContactsArray, $_GET["id"])) {
if ($i==0) $tpl->Zone("contactsTab", "enabled");
$contactEntityArray[$i]["contact.username"] = _fnc("user", $contactsUserID, "username");
$contactEntityArray[$i]["contact.id"] = $contactsUserID;
$contactEntityArray[$i]["contact.mainpicture"] = _fnc("user", $contactsUserID, "mainpicture");
$i++;
}
}
}
else $tpl ->Zone("contacts", "disabled");
if (isset($contactEntityArray)) $tpl -> Loop("contactEntity", $contactEntityArray);
Any help solving this would be more greatly appreciated
No comments posted yet
Your Answer:
Login to answer
250
8
Other forums
How to kill asynchronous postback / current postback?
Hi,here is my problem:I have a web site with many pages of which some may take time to process resul
How To Make More Than One Redirection with PHP on the same page?
Hey im trying to do a direction page where it open differently link direction pages every time som
RSS poster script?
I have found a script that posts RSS's for me on a site that I'm building. However I would like to a
form variables from database help.
Hi all,
I would like to have a form that gives you options based on the results of an mysql q
How to get all server headers like Live http Headers does
Hey all, like many of you I use the Firefox addon "Live http Headers". I'm trying to write
Count of reciepients in php mailer
How can i sent a mail to large no of reciepients say 10,00,00 Using PHP MAILER
problems with search form numerical "between" sending by php
I am trying to display the results of a search, on a sql database, on a web page. I set up html &quo
Echo multiple lines of html code
Hi guys,
I would like to know if there is a way to echo multiple lines of html codes.
IIS7 and getimagesize() problem
I have just discovered after hrs of trying to fix a problem where it's coming from. It's to do with
how can i make a .gif images for my site
Dear Friends ,
Pls solve my problem , I am starting making new site but i dont know how can i