Welcome to Geeklog, Anonymous Thursday, March 28 2024 @ 10:27 am EDT

Geeklog Forums

function calls in static pages


Status: offline

amckay

Forum User
Full Member
Registered: 03/23/02
Posts: 180
OK, so I have it working. It's really easy. Inside public_html/staticpages/index.php insert the following function :


function ParseForFunctionCalls($myStr)
{
$workStr = $myStr;
$newStr = "";

while( $callBegin = strpos( $workStr, "[call]" ) )
{
$newStr .= substr( $workStr, 0, $callBegin );
$callEnd = strpos( $workStr, "[/call]" );
$newWorkStr = substr( $workStr, $callEnd + 7 );
$funcname = trim(substr( $workStr, $callBegin + 6,$callEnd - $callBegin - 6 ));
$newStr .= $funcname();
$workStr = $newWorkStr;
}

return $newStr . $workStr;
}


And you insert the call just after line 100 right after the DB_fetchArray :


$A['sp_content'] = ParseForFunctionCalls($A['sp_content']);


And within your static pages you can insert any number of [call]someFunction[/call] statements that you like!

This is going to be a very huge improvement for my website - don't know why I didn't get around to it earlier.

cheers,
-Alan

 Quote

Anonymous

Anonymous
Thanks much. This will come in handy.
 Quote

Status: offline

amckay

Forum User
Full Member
Registered: 03/23/02
Posts: 180
BTW, my code appears to not work if [call] is the very first characters in a static page, or [/call] is the very last. If I get around to fixing it I'll post an update. In the meantime I just do not let that happen ;-)
 Quote

All times are EDT. The time is now 10:27 am.

  • 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