Notice

This old forum is now only available for consultation/read. User accounts on this old website are blocked.
Please create a new account on seblod.com and use the new forum http://www.seblod.com/community/forums.
Apologies for this perturbation and thank you for your understanding!
Welcome, Guest
Username Password: Remember me

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

TOPIC: PHP snippets wherever you want

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

  • Castor
  • ( User )
  • OFFLINE
  • 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:

step1_engl.jpg



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

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


disable HTML, CSS and Javascript

step2_engl.jpg


step2_2_engl.jpg


step2_3_engl.jpg


step2_4_engl.jpg





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

step3_2012-03-13.jpg



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

step4_2012-03-13.jpg


Step 4:
Positioning in the template:

step5.jpg


Step 5:
Test it!

erklaerung.jpg



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

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

  • giorgia
  • ( User )
  • OFFLINE
  • 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!
Giorgia
  • Page:
  • 1
Time to create page: 0.22 seconds