Welcome to Geeklog, Anonymous Monday, November 25 2024 @ 09:41 pm EST

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 EST. The time is now 09:41 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