473,471 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

flexible scope strategies for include()

Can anyone suggest to me a strategy for including() a variable on a
page from within a function but somehow getting that function into
global space? Let us suppose that I have this document:

<?php
$string = "

$headline -
In the navigation bar this entry shows up as: $navText.
This entry was created on: $dateCreated .
This entry starts with $textBlock1 . If there is a quote, this is how
it starts: $quoteBlock1.
These are the people with permission to edit this page: $belongsToWho.
Number of times viewed: $numTimesViewed.
Theme words: $keyword01, $keyword02, $keyword03, $keyword04,
$keyword05, $keyword06
This entry is of this type: $isWhichType . Number for this entry: <a
href='index.php?pageId=$id'>$id</a>

";
?>


And I want to include it from inside this class method, but using the
class method $controllerForAll->import("mcArrangementShortFormLists.php").
I'm having scope trouble and I'm trying to think of a way around it.



function combineEntryInfo($entry) {
// 06-18-03 - you ask, what is this function for? Well, often, in
the past, I've built a form to do something like, say, delete
// articles. Normally I would fetch the id and the headline of each
article and present that info and ask if people wanted to
// delete it. I'd go through them in a for link and print them all
out, and give the person the option to delete what they wanted.
// But what if the person wanted the headline to be blank? Then
there is no text there. So, the person then looking an entry that
// gives no information about itself, but asks "Do you want to
delete this article?" And they've no way of knowing what that article
// might be. Also, there are times when a user will want to give the
same title to two different articles. And then, looking at the form
// and being asked what they want to delete, how do they know which
one it is they want to delete? They have to guess. I'm writing
// this function out of frustration with all that, I'm now going to
the opposite extreme, my intention is to offer a great deal of
information
// in the forms, so people know what the hell it is they are
deleting, or editing, or whatever.
$cbId = $entry[0];
$entryWithKeys = $this->sql->getEntryAsObject($cbId);
$controllerForAll = & $GLOBALS["controllerForAll"];
$dataTableForStandardPages =
$controllerForAll->getObject("McDataTableForStandardPages");
$convertedEntryWithKeys =
$dataTableForStandardPages->convertEntryWithKeysFromDs($entryWithKeys);
$dataTableForStandardPages->shortenValuesToSummaries();
$table = $dataTableForStandardPages->getTable();
if (is_array($table)) extract($table);
$string = $controllerForAll->import("mcArrangementShortFormLists.php");
return $string;
}
Jul 17 '05 #1
0 1770

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

Similar topics

6
by: Tom | last post by:
I'm tying myself in knots trying to figure out variable scope with constants and include files. This is what I'm doing: A page (index.php) on my website includes a general purpose include file...
5
by: William | last post by:
In Peer.h, I have: class Peer { // ... }; In Overseer.h, I have: #include "Peer.h" #include <vector>
2
by: Christopher Benson-Manica | last post by:
Is the following program conforming under C99? #include <stdio.h> typedef struct foo { int bar; int baz; } foo; foo foos={
165
by: Dieter | last post by:
Hi. In the snippet of code below, I'm trying to understand why when the struct dirent ** namelist is declared with "file" scope, I don't have a problem freeing the allocated memory. But...
20
by: mechanicfem | last post by:
I thought (as they're in c99) that flexible arrays were there for a number of reasons - but I also thought they'd be great for stepping into structures (say) that were aligned in memory after (say)...
6
by: Wescotte | last post by:
I'm having an issue where what should be global variables are not in scope and I'm confused as to why. In Case 1 the variables are not in scope for functions in File2 In Case 2 the varibales are...
0
by: origami.takarana | last post by:
Intrusion Detection Strategies ----------------------------------- Until now, we’ve primarily discussed monitoring in how it relates to intrusion detection, but there’s more to an overall...
0
by: David Troxell - Encourager Software | last post by:
Product Scope 7 (http://www.encouragersoftware.com/) and Profile Exchanges enhanced with SetupCast publishing methods NOTE: If you are a software author, releasing commercial and/or shareware...
1
by: CyrexCore2k | last post by:
Hello all, Apologies if this is the wrong forum. This one seemed to be the most appropriate. I'm looking for resources pertaining to developing scalable and flexible application designs. I...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
1
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...
0
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...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.