473,756 Members | 2,558 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I display this kind of 2-dim array value correctly?

[PHP]
$successMsgArra y = array('image' => array('add_albu m' => 'Album:
"$album" has been created',
'edit_album' => 'Information for album "$album" has
been changed'));
[/PHP]

I am having to return the following in a class method:

[PHP]
return $successMsgArra y[$section][$action];
[/PHP]

Where the contents of $successMsgArra y[$section][$action] will have
the "placeholde rs" replaced by their variable values, so if you want
to return $successMsgArra y['image']['add_album'] you should see:

Album "Phil" has been created
Where $album = 'Phil'

instead of

Album "$album" has been created
How on earth do I do this? I have tried every combination of printf,
sprintf, echo, and eval that there could be done, to no avail. I'm
completely confused as to how to return this 2-dim array value into
something readable.

Here is the class method I have so far that fails miserably:

[PHP]

class MethodGenerator ForActionPerfor mer {

function &getSuccessMsg( ) { // STATIC STRING METHOD
global $section, $action, ${$section . 'LocationPath'} ,
$successMsgArra y;
if (is_array($_POS T) && @sizeof($_POST) > 0) foreach ($_POST as $key
=> $val) if (!isset(${$key} )) ${$key} = $val;
$this->fileName = ($_POST['image_name']) ? $_POST['image_name'] :
$this->fileName;
echo eval('$msg = ' . $successMsgArra y[$section][$action]);
return $msg;
}

}
[/PHP]

Thanx
Phil
Jul 17 '05 #1
1 1764
> How on earth do I do this? I have tried every combination of printf,
sprintf, echo, and eval that there could be done, to no avail. I'm
completely confused as to how to return this 2-dim array value into
something readable.


You simply have a problem when creating the array:

[PHP]
$successMsgArra y = array('image' => array('add_albu m' => 'Album: "$album"
has been created', 'edit_album' => 'Information for album "$album" has been
changed'));
[/PHP]

should be

[PHP]
$successMsgArra y = array('image' => array('add_albu m' => "Album: $album has
been created", 'edit_album' => "Informatio n for album $album has been
changed"));
[/PHP]

_______________ _______________ ______
Wil Moore III, MCP | Integrations Specialist
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
7737
by: Axel Dahmen | last post by:
Hi, current browsers don't support "display: inline-block;" and "display: inline-table;", resp. Thus I'm using "float: left;" to achieve a similar effect. Problem is that if a row of elements uses this kind of block floating, they don't wrap to build a whole new line but instead get "hooked" at the left-most element being larger than the element right beside this "overflowing" element.
23
3160
by: Mat | last post by:
<div id="container"> <div id="main"> <div id="header"> <p class="Address">123 Fake Street, </p> <p class="City">Crazy City, </p> <p class="Province">Ontario </p> <p class="PostalCode">H0H 0H0</p> <p class="Telephone">Telephone: 555-1234 </p> <p class="Fax">Fax: 555-4321</p> </div>
5
1728
by: Jack | last post by:
Hi, I need to build a asp page where it would serve as a data entry record page as well as display page for records saved. This page should also allow editing of records that has been saved. e.g. SAVEBUTTON SS# EntryBox Name EntryBox Date EntryBox Revenue Generated EntryBox
5
1185
by: Gill | last post by:
Hi There, Does anyone can give me advices to choose a graphical library/control/ocx/other to developp an application displaying 2d lines from large data set (around 30 000 points). I have to developp this app using Visual C++(6 or .NET). These data are coming right from an electronic device, and I need to display and print result as graphs in a short amount of time (less than 8 hours :o) )
6
11126
by: rroman | last post by:
I've tried the good old fashioned msgBox but I get: It is invalid to show a modal dialog or form when the application is not running in UserInteractive mode. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
6
2304
by: Mark | last post by:
Hello all, I have the following file.txt storing these kind of values: Name: John Doe E-mail: john@doe.com Phone: 555 865 8901 Address: 71 Huntington Ln. (33444) FL - Delray Beach US Member ID: 373732510149005 Registration date: 5/2005
3
1514
by: Alex Maghen | last post by:
Hi. I have a whole bunch of queries that I'll be running and returning in OleDbDataReader objects. Some of these DataReaders will just be a simple singe table result and others will be more complex with Sub-Tables and Summaries, etc., etc. Here's my question: Is there a way to use any of the ASP.NET 2.0 Data Controls - or any other mechanism - to display the DataReader results without having to define all of the columns and all that in...
4
3268
by: Jono | last post by:
Hi Everyone, As it says in the title, I'm looking for a way to display a page while long running operations are performed on the server. Ideally, I'd like some way to push the current request onto some stack, where it would continue to be processed asynchronously (most importantly preserving things like view state, form post data, etc). In the interim, while the main request is processed, a friendly page will be displayed to the user....
2
1714
by: Lupus | last post by:
Hi, I've written a function in javascript to obtain content using AJAX. While AJAX is loading, I want to show a div which says "please wait while loading. This is a part of the function: z.style.display = "none"; y.style.display = "block"; ajax = new AjaxHandler;
15
2704
by: paul814 | last post by:
Is it possible to display the logged in user that is accessing the form, in a textbox? so say I have txtname I want to display the username of the person that is logged in to the PC in that box, can I do this? How would this be done?
0
9462
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9886
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9857
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8723
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7259
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5155
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3369
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2677
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.