This old forum is now only available for consultation/read. User accounts on this old website are blocked.
Please create a new account on and use the new forum
Apologies for this perturbation and thank you for your understanding!
Welcome, Guest

PHP snippets wherever you want
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: PHP snippets wherever you want

PHP snippets wherever you want 4 years, 7 months ago #1

  • Castor
  • ( User )
  • Senior Boarder
  • Posts: 68
Hi all,

how can you create fields with PHP-code in any position of your template that you want

Step 1:
install the great module blank module from Bob Galway - you can find this under Custom Code in Modules it's for free!

Step 2:
create custom code:


with this code in this case you can insert pictures in any position from your template according to the values ​​of a multiselect field - see -> select simple / multiple with image options?:
$cck = CCK_Rendering::getInstance();
if (isset($cck->get('country')->value)) {
$extension = 'jpg'; // or gif or jpg ...
$values = explode ($cck->get('country')->divider, $cck->get('country')->value);
if (is_array($values)) {
$imgstr = '';
foreach ($values as $value) {
$imgstr .= ($value != '') ? "<img src=\"/images/$value.$extension\" alt=\"$value\" />" : '';
echo $imgstr;

or to solve this question

$pieces = explode("/", $uri);
$uri_3 = $pieces[3];
echo "URI_3: " . $uri_3;

disable HTML, CSS and Javascript





Step 3:
create one free text in your content form at the desired position


Editor - in this example insert just {loadposition imagestring} -> imagestring in this case is position from this module


Step 4:
Positioning in the template:


Step 5:
Test it!


Working on JOOMLA (latest) and SEBLOD (latest)
Last Edit: 4 years, 7 months ago by Castor.
The following user(s) said Thank You: ssnobben, serval, nithinp89

Re: PHP snippets wherever you want 4 years ago #2

  • giorgia
  • ( User )
  • Fresh Boarder
  • Posts: 5
Hi Castor , I'm Italian so please forgive my English.
I did everything you say in your post but it does not work, because I'm missing a step: the parameters of the blank module in the "select article", you set "modul archiv", you must create an article called "modul", archive, and select ? and what to put in it?

images? the code? the string {loadposition position}? (I tried them all, does not work!)

Everything else I followed to the letter: creating a field "test free" content with cck and writing precisely loadposition with the position of the module or loadmodule with the id of the form - putting any module, it loads (eg put the id of a custom module with an image, loading the image precisely in the position in which I put the field), while the module_balnk does not work.

Please, can you help?

Thank you very much!
  • Page:
  • 1
Time to create page: 0.46 seconds