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
problem with refreshing
in my site, i have an index page, it has a main div. this main div's content is changing according to the menu click as home, products etc. div is populating itz contents with html pages for these
New to Arrays
Hi I am new to PHP (a week and a half now) and I am just beginning to read about arrays. I understand simple arrays, associative arrays, and multidimensional arrays also. The book I am reading
Multiple forms on the same page (safari)
Hello everyone,I have 3 forms on the same page, that opens in a new window and submits to a php file, this works great in IE8 but I can not get it to work in safari, I can click on the first submit
blank page.... nothing is happening.
I'm new to a lot of this but in the last 24hrs have learned a lot.Installed latest version of mysql... went fine no problems.Installed latest version of php... went fine no problems.did all my
"GROUP BY" in arrays
Well i'm looking to do something i usually could do easily using COUNT and GROUP BY if it was a sql query... But this time i'm working with an array...so i have an array that looks like thisCode:
How to schedule the a job?
Hi,
I need help with formatting date from mysql! with php!
Hello guys*Note: this is a php question not MySQL question, please do not move it to mysql section! Thank you.anyway, I have a record from the database as 2009-12-31 23:59:59I needed to when ever I
Losing 'page' data
I have this code that allows me to update my database. But after updating, I lose the $_GET['page'] value in the browser. I need this value because it is passed when I go to other pages on the
Problem executing bash script using shell_exec
Hi there,I created a bash script file using following code to convert doc documents to pdf using OpenOffice macros.*************************doc2pdf:#!/bin/shecho "hi"DIR=$(pwd)
javascript in php code causes page to display white
Hi All,Odd one this, I've got the following code (below) which is a simple log in form. The client wanted a pop to inform you when you've not completed a field and an asterix to appear.This is fine.