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
Filtering Tables
Hello Thanks for any help any one can give Im very new to PHP..I need to pull data for clients that share 2 diff services into one table.mysql_select_db($database_pull, $pull);$query_Recordset1 =
Place specific image in html page when specific name is typed.
Hello,Fairly new to PHP and was curious if someone might know how to solve a fairly simple request.I am currently passing the name of an end user (who types their name in a form field) to a URL which
Echoing a Variable from a Object
How do I get a variable from the new User Class to echo out in this clasS?class MyApp{ function __construct() { global $dbHost; global $dbUser; global $dbPass; global $dbName; $this->DB =
show the direct link into href
I want to display link on the page. i am fetching the data(URL) from database,actually before that i am checking if it is URL or not. if it is URL, let take an example google.com so it should take me
socket makes browser hang...
I have a socket server, and I am having a problem at the moment...A browser sends a http header request to the server, but... some browsers send one request for one file, and others want 2. For
convert PHP array to Javascript array
I have a page that gets a request sent from AJAX, and I am trying to convert a PHP array to a javascript array. is this possible? I tried with Json_encode but it doesn't seem to work. is there
How to replace search button with link?
hi to everbody.i have a search submit form and button like this :<form id="f1" name="title" method="post"
Operating System
How in PHP or other language can I detect Operating system, ie Windows XP Home, Windows 7 Ultimate, Mac OS 10?Anyone know how?Thanks
mysql_query returning boolean instead of mysql ressource
Hi,I seem to have a weird issue with the php command mysql_query. I pass 2 arguments the query in a string format (SQL is working properly) and a database ressource which is also good. The problem is
Mail from PHP form not always ending up in my inbox?
Hi guys,I'm a real newbie to PHP and have managed to put together a simple mail form that sends me an email when someone fills it in on my site.The problem I am having, is that sometimes when I test