digitalpoint
05-08-2004, 05:42 PM
I have an external script I call that generates a static text file with the 5 most recent threads (I do it this way because doing it "live" with external.php was overwhelming my forum server do to the number of requests for the file).
I've added this to newthread.php, and it works fine (2nd line is just for reference):
include ("external-dps.php");
eval(print_standard_redirect('redirect_postthanks' ));
But I would rather do it within the templates so I don't have to hack on the newthread.php file after each upgrade. And I *almost* have it working like so:
Added to phpinclude_start template:
if ($_SERVER[PHP_SELF] == '/newthread.php' && $_REQUEST['do'] == "postthread" && $_REQUEST['sbutton']){
define ("build_external", 1);
Added to phpinclude_end template:
if (build_external == 1) include ("http://forums.digitalpoint.com/external-dps.php");
It works if there is an error with the new thread, but since it redirects to the thread upon a success, the build_external variable is destroyed by the time phpinclude_end is called. It's done with a define() because it needs to be accessed within a function. Also, I had to change the include when using the templates to use the full URL, as it was getting some errors and didn't feel like tracing the errors around.
Is it possible to add a unique flag to the user session? (Would be simple if it vB used the "normal" PHP sessions, but since they are custom, I have not dug too much into it yet). I suppose I could also do it with a cookie, but would prefer not to.
- Shawn
I've added this to newthread.php, and it works fine (2nd line is just for reference):
include ("external-dps.php");
eval(print_standard_redirect('redirect_postthanks' ));
But I would rather do it within the templates so I don't have to hack on the newthread.php file after each upgrade. And I *almost* have it working like so:
Added to phpinclude_start template:
if ($_SERVER[PHP_SELF] == '/newthread.php' && $_REQUEST['do'] == "postthread" && $_REQUEST['sbutton']){
define ("build_external", 1);
Added to phpinclude_end template:
if (build_external == 1) include ("http://forums.digitalpoint.com/external-dps.php");
It works if there is an error with the new thread, but since it redirects to the thread upon a success, the build_external variable is destroyed by the time phpinclude_end is called. It's done with a define() because it needs to be accessed within a function. Also, I had to change the include when using the templates to use the full URL, as it was getting some errors and didn't feel like tracing the errors around.
Is it possible to add a unique flag to the user session? (Would be simple if it vB used the "normal" PHP sessions, but since they are custom, I have not dug too much into it yet). I suppose I could also do it with a cookie, but would prefer not to.
- Shawn