473,548 Members | 2,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Selective rendering of part of a page

I want to skip the rendering of certain parts of a Web page if the
user doesn't have a certain permission (e.g. a cookie). I'd like to do
it along these lines:

<p>Anybody can see this paragraph.</p>
<? start_protected _section($got_p ermission); ?>
<p>Not everybody can see this paragraph.</p>
<? end_protected_s ection(); ?>

Is it possible to disable the rendering of a section outside the code
like this (perhaps by setting a PHP flag to redirect subsequent
output)? I don't really want to complicate things by moving part of
the page into a separate "include file" or mixing the HTML and PHP by
using a here-document (the <<<END syntax).

Eq.
Dec 23 '06 #1
3 1960
Message-ID: <BI************ *************** ***@bt.comfrom Paul E
Collins contained the following:
><p>Anybody can see this paragraph.</p>
<? start_protected _section($got_p ermission); ?>
<p>Not everybody can see this paragraph.</p>
<? end_protected_s ection(); ?>

Is it possible to disable the rendering of a section outside the code
like this (perhaps by setting a PHP flag to redirect subsequent
output)? I don't really want to complicate things by moving part of
the page into a separate "include file" or mixing the HTML and PHP by
using a here-document (the <<<END syntax).
<?php
if($condition){
?>
protected html here
<?php
}
?>

--
Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs http://www.ckdog.co.uk/rfdmaker/
Dec 23 '06 #2
"Paul E Collins" <fi************ ******@CL4.orgw rote:
I want to skip the rendering of certain parts of a Web page if the
user doesn't have a certain permission (e.g. a cookie). I'd like to do
it along these lines:

<p>Anybody can see this paragraph.</p>
<? start_protected _section($got_p ermission); ?>
<p>Not everybody can see this paragraph.</p>
<? end_protected_s ection(); ?>

Is it possible to disable the rendering of a section outside the code
like this (perhaps by setting a PHP flag to redirect subsequent
output)? I don't really want to complicate things by moving part of
the page into a separate "include file" or mixing the HTML and PHP by
using a here-document (the <<<END syntax).

Mostly HTML, few PHP. Enclose the PHP code between <? ?:

<p>Anybody can see this paragraph.</p>

<? if( $got_permission ){ ?>

<p>Not everybody can see this paragraph.</p>

<? } ?>

Mostly PHP, few HTML. Enclose the HTML code between ?<? :

?<p>Anybody can see this paragraph.</p<?

if( $got_permission ){

?<p>Not everybody can see this paragraph.</p<?

}
Regards,
___
/_|_\ Umberto Salsi
\/_\/ www.icosaedro.it

Dec 23 '06 #3

Paul E Collins schrieb:
I want to skip the rendering of certain parts of a Web page if the
user doesn't have a certain permission (e.g. a cookie). I'd like to do
it along these lines:

<p>Anybody can see this paragraph.</p>
<? start_protected _section($got_p ermission); ?>
<p>Not everybody can see this paragraph.</p>
<? end_protected_s ection(); ?>
Go and download a template engine like Smarty

http://smarty.php.net/

and separate your code from your layout. I use it for quite some time
and maintainability of code is much better.

Dec 23 '06 #4

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

Similar topics

5
5264
by: Sue | last post by:
On code-behind page: (attributes set programatically for each of these elements) linkbutton added to tablecell textbox added to tablecell tablecells added to tablerow tablerow added to table (table.ID is TestTable) On .aspx page: <HeaderTemplate> <asp:Table ID="TestTable" runat="Server" /> </HeaderTemplate>
1
2700
by: The Master | last post by:
For the most part I think I have it rendering correctly on Opera 7.5, Firefox .8, and IE 6 for Windows (the only exception is IE 6 for windows adds an extra space between the Top Nav and the Left Nav/Content Area, kind of annoying but not enough to ruin the layout). However if I load it up on IE 5.2 Mac, Pushes the content to be bellow the...
3
1847
by: Shreeram | last post by:
Hello, I have a chart object which returns the chart created as a BitMap object. I want to render this Bitmap object as an image in a WebPart iam developing. Can anyone please tell me how to go about doing it.
2
3256
by: Spotnick | last post by:
I have no idea why, but since I'm trying to recreate my website using ASP.NET 2.0 I've encountered so many performance issues that I'm about to give up and continue using v1.1 Seriously, how can a page that is not that complicated be so long to render locally, it's amazing. This is the trace info: aspx.page Begin PreInit
0
1377
by: Jeff Morgan | last post by:
I have an application that runs on ASP.NET. We have been working through performance testing and it appears that at about 40-50 users, I start to get CPU bound. The application is a three form, ASP.NET 2.0 application. A login page, and a main page, that is a frame with a header page, and the main page. On the main page, there are two...
6
1957
by: Justin.Voelker | last post by:
Can anyone clue me on on how to have my html page continue rendering past a MySQL error? If you visit www.Base2WebDesign.com, click login, type in anything for a username and password, then view the page source. You will see that the page displays the error then just stops rendering the html. (I know what the error is, I deleted that table...
0
1568
by: arindams | last post by:
I've a form where an webrowser contains a html file. I want to copy a selective portion of the html content and paste that content in an excel 2007 file where it will be pasted as a normal text (not in HTML code). I want to have the excel part should be as it is done manually (i.e. it should be in proper format as it is in the HTML file). ...
3
2414
by: SAL | last post by:
Hello, I did google this issue and found some stuff related to BrowserCaps section of either web.config or machine.config but it didn't work. It seems that most pages in my webapp are okay but a couple of the Firefox is munging up. So, on my information page there is a gridview in the content section of the page. The masterpage contains...
0
7711
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7954
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...
1
7467
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...
0
6039
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...
1
5367
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...
0
3497
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...
0
3478
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1932
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 we have to send another system
0
755
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...

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.