[resolved] Use Thickbox to load html or php (6 posts)

  1. juri003
    Posted 6 years ago #


    Does anyone know if it is possible to load html or php files instead of images with thickbox? I've been working on it for quit some time, also tried other lightbox techniques but nothing seems to work.

    This is what I try to recreate: http://www.jurisverbeelding.nl/reportage12.html (click on text: Trash)

    Here is the page in my worpress enviroment: http://2010.jurisverbeelding.nl/foto/reportage (click on text: Trash)

    I added the thickbox class, perhaps I need a rel?


  2. Mark / t31os

    Posted 6 years ago #

    Yes you'll probably need a rel tag on there to..


  3. juri003
    Posted 6 years ago #

    Hey t31os_

    Thanks for your reply. Unfortunately that doesn't do the trick. It seems there is really a some kind of hack necessary to support content other than images.


  4. Mark / t31os

    Posted 6 years ago #

    Been a while since i done it, but i've used thickbox to display php files, so i know it's possible to use it for other things, i'll go see if i've still got the code i used and make a suggestion.


    Checked whilst i was writing the reply, here's the attachment.php from a theme where i used thickbox to handle the display of attachments, some were php/phps files, others were images.


    I also had to add php and phps to the whitelist for allowed mime types in order to upload them, which was done with the following.

    function custom_upload_mimes ( $mimes ) {
    	$mimes['php'] = 'application/x-httpd-php-source';
    	$mimes['phps'] = 'application/x-httpd-php-source';
    	return $mimes;
    add_filter( 'upload_mimes' , 'custom_upload_mimes' );

    On top of that i also forced a content type in the upload directory(via htaccess file in the upload folder) when a file matched .php or .phps, i don't have that code backed up but it looked like something along these lines though.

    <FilesMatch "\.(php|phps)$">
    Content-Type: application/x-httpd-php-source

    Beyond that, i'm not really sure if there was anything else i did(was 3 months ago and i'm no longer using the code), but perhaps you can take something away from the code i've provided.

    EDIT: Additionally i added some URL rewrites to swap out the real file locations for some custom URLs, but that doesn't play any part in the code working(that was just a personal touch so people couldn't query the php files directly, etc..)

  5. juri003
    Posted 6 years ago #


    There was a very small but helpfull piece of code there! I just needed to add this behind the source document:


    Now I only need to get rid of those nasty scrolls but I'll probably manage that!


  6. Mark / t31os

    Posted 6 years ago #

    Had a feeling it might be the TB_Frame part you needed, but thought it might serve you better to just post up the code so you pick from it what you need.

    Happy to help in any case.. ;)

Topic Closed

This topic has been closed to new replies.

About this Topic