HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


What does it mean when this happens?

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#21412 (In Topic #5165)

Fan in action

I was so proud, I got my first template and block working great and now for some reason, the block's "source code" is just displayed as plain text on my page…… The thing is I don't know why :dry: There are even some chinese (japanese?) symbols at the bottom.

Does anyone know what is hapening?



(note, mt_rand is 1,1 because I only got 1 entry finished so i could make sure it looked ok)

The Block 'defender_gallery_databank' (customized main_iotd, but 95% of that stuff is gone)

Code (php)

<?php /*

 ocPortal
 Copyright (c) ocProducts, 2004-2006

 You may not distribute a modified version of this file, unless it is solely as an ocPortal modification.
 See text/en/licence.txt for full licencing information.

*/


class Block_defender_gallery_databank
{

   /**
    * Standard modular info function.
    *
    * @return ?array    Map of module info (NULL: module is disabled).
    */

   function info()
   {
      //removed-assert

      $info=array();
      $info['author']='Eric Lacombe';
      $info['organisation']='Jedi Archives';
      $info['hacked_by']=NULL;
      $info['hack_version']=NULL;
      $info['version']=2;
      $info['locked']=true;
      $info['parameters']=array('param');
      return $info;
   }
   
   /**
    * Standard modular cache function.
    *
    * @return ?array    Map of cache details (cache_on and ttl) (NULL: module is disabled).
    */


     function cacheing_environment()
     {
      //removed-assert

      $info=array();
      $info['cache_on']='array($GLOBALS[\'FORUM_DRIVER\']->get_members_groups(get_member()),array_key_exists(\'zone\',$map)?$map[\'zone\']:get_module_zone(\'iotds\'))';
      $info['ttl']=5;
      return $info;
     }
 
   /**
    * Standard modular run function.
    *
    * @param  array       A map of parameters.
    * @return tempcode    The result of execution.
    */


   function run($map)
   {

    include("./somefolder/somefolder/php/zones/databank.php");

    // ==================================================================
     $random = mt_rand(1,1);

     if ($random == "1") {
      $var_picture_large_source = "{$databank_large['001']}";
      $var_picture_small_source = "{$databank_small['001']}";
      $var_picture_caption = "{$databank_caption['001']}";
      $var_settings_target = "{$databank_target['001']}";
      $var_settings_border = "{$databank_border['001']}";
      $var_settings_title = "{$databank_title['001']}";
     }

    // ==================================================================
    // PICTURE_LARGE_SOURCE     => The url to the large 640x480 picture.
    // PICTURE_SMALL_SOURCE     => The url to the small 200x150 picture.
    // PICTURE_CAPTION          => The caption for the current picture.
    // SETTINGS_TARGET          => The new window target, usually _Blank.
    // SETTINGS_BORDER          => if 0 then no border around the linked thumbnail.
    // SETTINGS_TITLE           => able to customize title of block based on image theme.
    // SETTINGS_PATH            => The file path to the images

     return do_template('DEFENDER_GALLERY',array('_GUID'=>'d710da3675a1775867168ae37db02ad4','PICTURE_LARGE_SOURCE'=>$var_picture_large_source,'PICTURE_SMALL_SOURCE'=>$var_picture_small_source,'PICTURE_CAPTION'=>$var_picture_caption,'SETTINGS_TARGET'=>$var_settings_target,'SETTINGS_BORDER'=>$var_settings_border,'SETTINGS_TITLE'=>$var_settings_title,'SETTINGS_PATH'=>$var_settings_path));
   }

}

?>
 

The Template 'DEFENDER_GALLERY'

Code (php)

{+START,BOX,{SETTINGS_TITLE*},100%|230px,curved,,,}
   <br />
   <center><a href='{SETTINGS_PATH*}{PICTURE_LARGE_SOURCE*}' target='{SETTINGS_TARGET*}'><img src='{SETTINGS_PATH*}{PICTURE_SMALL_SOURCE*}' border='{SETTINGS_BORDER*}' title='{PICTURE_CAPTION*}'></a></center>
   <br />
   <center><font size='2'>{PICTURE_CAPTION*}</font></center>
{+END}

The zones/databank.php

Code (php)

 $databank_large['001']         = "games/large/1001.jpg";
 $databank_small['001']         = "games/small/1001.jpg";
 $databank_caption['001']       = "Feel the power of the dark side!";
 $databank_target['001']        = "_Blank";
 $databank_border['001']        = "0";
 $databank_title['001']         = "Databank Gameplay Image";
 $var_settings_path = "http://jediarchives.ca/somefolder/somefolder/somefolder/zone_gallery/";
 


Last edit: by mrdefender

ocProducts :wub: :wub:

Click here to drop by my website!
Back to the top
 
Posted
Rating:
#21428
Avatar

For the record, I have access to mrdefenders server.

I've had a look on-server, and it looks like your block file has either been corrupted, or saved in something called "UTF-16". I'm not sure which at a glance, but it's definitely not a very-plain-text file, as there are a lot of special text characters between each proper one.

EDIT: And of course, congratulations on the block :).


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#21464

Fan in action

Hmm. Very odd indeed. I'm not exactly sure how it happend but I seem to have fixed it now.

What I did was copy the contents of defender_gallery_databank.php , paste it in a temp text file (simply start > run > metapad > paste but not saved) deleted the php file and saved the temp text file as the php file and re-uploaded it to my server. That seems to have fixed the issue.

Metapad has 4 formats to save in, which one should I use? It looks like by default its "Unicode" but there's "Dos Text (CR+LF)", "UNIX Text (LF)" and "Unicode (Big Endian)" … ?

edited: Hmm. Dos Text seems to be the one, I saved the block again and it happend again, but now i think i fixed it :lol:


Last edit: by mrdefender

ocProducts :wub: :wub:

Click here to drop by my website!
Back to the top
 
Posted
Rating:
#21467
Avatar

UNIX Text is best, but DOS Text is almost always okay too.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#21473

Fan in action

Thanks :)

ocProducts :wub: :wub:

Click here to drop by my website!
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: