Welcome to Geeklog, Anonymous Sunday, November 24 2024 @ 12:47 pm EST

Geeklog Forums

How can I break PHP staticpages?


Status: offline

LWC

Forum User
Full Member
Registered: 02/19/04
Posts: 818
How can I make PHP staticpages only work in certain situations?

If I try:
Text Formatted Code
if (...)
exit();

then it also blanks out the entire page (if it's a centerblock).

If I try:
Text Formatted Code
if (...)
break;

or
Text Formatted Code
if (...)
continue;

tnen the staticpage causes this error:
Fatal error: Cannot break/continue 1 level: eval()'d code


Finally,
Text Formatted Code
if (...)
return "";

does work, but is this the correct way? It's not a function after all, but direct code.
 Quote

Status: offline

jmucchiello

Forum User
Full Member
Registered: 08/29/05
Posts: 985
If the static page is of the return a string type, you just return an empty string.

If it's an output captured page, return should work. You get the result of the eval'd code by checking the return from eval:

$result = eval("return 4;"Wink;

If you don't have anything to return, use return;

 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
Quote by: LWC

How can I make PHP staticpages only work in certain situations?


Depends on what you want to happen. COM_displayMessageAndAbort, maybe?

bye, Dirk
 Quote

Status: offline

LWC

Forum User
Full Member
Registered: 02/19/04
Posts: 818
No, because I want nothing to happen. I want to run the staticpage in all pages, but only show up if the URL contains a certain word.
 Quote

All times are EST. The time is now 12:47 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content