Posts: 110
Threads: 3
Joined: Sep 2010
mvlcek Wrote:alienee2 Wrote:thanks again for your help...not sure why this isn't working for me....
I don't have any idea either - you are using the newest version of DynPages, aren't you?
Are you using I18N, too? Newest version?
There was a combination of versions of DynPages and I18N that didn't work...
Doh! I was using i18n 2.4...just updated and it now works...
thanks again for the help/suggestions...and sorry for not checking to install the latest versions first...
-marc
Posts: 8
Threads: 1
Joined: Feb 2012
Excellent plugin!
Got one question:
Is it possible to pass a variable from a prevoius component, executed before in the same page, to a second component? ... something like:
{% component_1 %}
wich defines:
$one = "Hello World";
{% component_2 $one %}
Thanks a lot!
Luis
Posts: 2,094
Threads: 54
Joined: Jan 2011
lbordas Wrote:Is it possible to pass a variable from a prevoius component, executed before in the same page, to a second component?
You can use global variables to pass values, e.g. with component1
Code: <php
global $my_one1;
$my_one1 = ...
?>
and component2
Code: <?php
global $my_one1;
if (isset($my_one1)) {
// do something with $my_one1
}
?>
but in the call {% component2 ... %} you can only place constant values as arguments.
(Make sure to have some prefix ($my_) for global variables in order to not come into conflict with GetSimple or plugins)
Posts: 8
Threads: 1
Joined: Feb 2012
mvlcek Wrote:lbordas Wrote:Is it possible to pass a variable from a prevoius component, executed before in the same page, to a second component?
You can use global variables to pass values, e.g. with component1
Code: <php
global $my_one1;
$my_one1 = ...
?>
and component2
Code: <?php
global $my_one1;
if (isset($my_one1)) {
// do something with $my_one1
}
?>
but in the call {% component2 ... %} you can only place constant values as arguments.
(Make sure to have some prefix ($my_) for global variables in order to not come into conflict with GetSimple or plugins)
Hi mvlcek.
I need to pass the global variable name, so I used eval():
component1:
Code: <?php
global $my_one;
$my_one = "Hi there";
?>
component2:
Code: <?php
global $args;
echo eval('global $'. $args[0] . ';');
echo eval('return $'. $args[0] . ';');
?>
Then in the page I call:
{% test2 %}
{% test3 my_one %}
This way I can use the variable name as an argument in the second component (test3 in the example). I plan to use this to print different messages coming from a form validation, like errors...
Thanks a lot for your help :-)
Luis
Posts: 8
Threads: 1
Joined: Feb 2012
lbordas Wrote:mvlcek Wrote:lbordas Wrote:Is it possible to pass a variable from a prevoius component, executed before in the same page, to a second component?
You can use global variables to pass values, e.g. with component1
Code: <php
global $my_one1;
$my_one1 = ...
?>
and component2
Code: <?php
global $my_one1;
if (isset($my_one1)) {
// do something with $my_one1
}
?>
but in the call {% component2 ... %} you can only place constant values as arguments.
(Make sure to have some prefix ($my_) for global variables in order to not come into conflict with GetSimple or plugins)
Hi mvlcek.
I need to pass the global variable name, so I used eval():
component1:
Code: <?php
global $my_one;
$my_one = "Hi there";
?>
component2:
Code: <?php
global $args;
echo eval('global $'. $args[0] . ';');
echo eval('return $'. $args[0] . ';');
?>
Then in the page I call:
{% test2 %}
{% test3 my_one %}
This way I can use the variable name as an argument in the second component (test3 in the example). I plan to use this to print different messages coming from a form validation, like errors...
Thanks a lot for your help :-)
Luis
I made a typo. I meant:
{% component1 %}
{% component2 my_one %}
Then pass the global variable name to component2... sorry for my mistake.
Posts: 7
Threads: 2
Joined: Feb 2012
Hello, i used this dynpages, but i found a bug, i have multilanguage site, and the dynpages not show nothing in other language besides the default language.
How can I solve this?
Thanks
Posts: 2,094
Threads: 54
Joined: Jan 2011
ivobarbosa Wrote:... not show nothing in other language besides the default language.
I'm not sure if you mean that it shows nothing or that it does not show nothing, i.e. it shows something?
DynPages will show the named component, unless there is another one with the same name and _ and the language code - then it will show this component.
Just remember to not use _ in the base name, i.e. use my-comp and my-comp_de (German), but do not use my_comp and my_comp_en.
Posts: 7
Threads: 2
Joined: Feb 2012
mvlcek Wrote:ivobarbosa Wrote:... not show nothing in other language besides the default language.
I'm not sure if you mean that it shows nothing or that it does not show nothing, i.e. it shows something?
DynPages will show the named component, unless there is another one with the same name and _ and the language code - then it will show this component.
Just remember to not use _ in the base name, i.e. use my-comp and my-comp_de (German), but do not use my_comp and my_comp_en.
hello, i have portuguese language(pt) and spanish language(es) in my default language(pt) my component is mapa_workshops and in spanish is mapa_workshops_es when i insert {%mapa_workshops%} it shows my component content, and i insert {%mapa_workshops_es%} not show content of my component, sorry for my bad explanation, do you understand what i say?
Posts: 116
Threads: 8
Joined: Oct 2011
At first: great plugin ... :-)
I couldn't figure out the regular expression for a <total> replace solution not only "{% foo %}" ... My goal is to replace really anything. E.g. all "e" to "x" or any ;-) to a matching image....
Does anyone know how to change this line:
preg_replace_callback("/(<p>\s*)?{%\s*([a-zA-Z0-9_-]+)(\s+(?:%[^%\}]|[^%])+)?\s*%}(\s*<\/p>)?/",'dynpages_replace_match',$content);
best
Lars
Posts: 6,266
Threads: 181
Joined: Sep 2011
You would create your own plugin using a content filter and your own replacement regex or str_replace.
Posts: 6
Threads: 2
Joined: May 2012
I'd like to use DynPages with Random Content. However, when I put a DynPages shortcode into Random Content, I see the shortcode in the browser window and not the component.
It seems as if either DynPages is set to run just with the Page content, not the whole document. Is there any way therefore of making DynPages find and change content from the whole page, or another solution allowing DynPages to replace in other components prior to their rendering?
Posts: 2,094
Threads: 54
Joined: Jan 2011
trilbo Wrote:I'd like to use DynPages with Random Content. However, when I put a DynPages shortcode into Random Content, I see the shortcode in the browser window and not the component.
It seems as if either DynPages is set to run just with the Page content, not the whole document. Is there any way therefore of making DynPages find and change content from the whole page, or another solution allowing DynPages to replace in other components prior to their rendering?
As I don't know what Random Content does and how it works, I'm not sure if I can answer your question.
DynPages is for including components in a page's content.
If a page content is used by another plugin by any other way then calling the GetSimple function get_content(), this plugin must also call the content filter.
If you have a piece of content $content, which may include a DynPages shortcut {% mycomp %}, you can make DynPages process it by calling
Code: $content = dynpages_replace($content);
If you want to include a component in the template there is the GetSimple function get_component.
Posts: 89
Threads: 12
Joined: Feb 2012
2013-02-07, 11:49:00
(This post was last modified: 2013-02-07, 12:14:33 by stryker.)
Hello,
I love the simplicity of this pugin but am trying to setup a simple Youtube Component so the end user can add / modify their own youtube vids. ie pass arguments through.
I've created a theme component titled "youtube" and placed the following code in it.
<?php global $args;?>
<iframe width="560" height="315" src="http://www.youtube.com/embed/<?php $args[0];?>" frameborder="0" allowfullscreen></iframe>
Then on the page I have placed
{% youtube Gng3sPiJdzA %}
This should mean that the uniqueID on the page will pass through to the component but the argument does not pass through at all. The rest of the component works but where the ID should be it's nothing.
Any help to fix this issue with examples would be GREAT.
Thanks
EDIT: Actually I just tried another way and it seems to work but would love to know if it's the best way or not. I just changed the component so it's in one PHP statement and used the echo statement to output the youtube IFRAME (Changing double quotes to single quotes).
Therefore the component now is
<?php global $args;
echo "<iframe width='$args[1]' height='$args[2]' src='http://www.youtube.com/embed/$args[0]' frameborder='0' allowfullscreen></iframe>";?>
and the text on the page displays
{% youtube Gng3sPiJdzA 290 200 %}
This works OK with the ID, Width and Height comeing through and the vid displaying OK.
Is the is the only / best way to do it. If you want to pass arguments then everything has to be written within the one <?PHP statement.
Posts: 6,266
Threads: 181
Joined: Sep 2011
No you just need to echo the value.
You didn't echo the var in the first code you posted.
Posts: 89
Threads: 12
Joined: Feb 2012
Thanks Swawn_a.
Apreciate your confirmation of using the 'Echo" statement to make it work
Posts: 2,094
Threads: 54
Joined: Jan 2011
(2013-02-07, 11:49:00)stryker Wrote: I love the simplicity of this pugin but am trying to setup a simple Youtube Component so the end user can add / modify their own youtube vids. ie pass arguments through.
I've created a theme component titled "youtube" and placed the following code in it.
<?php global $args;?>
<iframe width="560" height="315" src="http://www.youtube.com/embed/<?php $args[0];?>" frameborder="0" allowfullscreen></iframe>
Then on the page I have placed
{% youtube Gng3sPiJdzA %}
<?php global $args;?>
<iframe width="560" height="315" src="http://www.youtube.com/embed/<?php echo $args[0];?>" frameborder="0" allowfullscreen></iframe>
Posts: 89
Threads: 12
Joined: Feb 2012
Ahhh. That makes sense. Thanks heaps mvlcek
Posts: 14
Threads: 0
Joined: Apr 2013
(2011-10-31, 04:13:25)alienee2 Wrote: jyoz22 Wrote:alienee2 Wrote:Hi -
I was wondering how to pass parameters to a component using the dynpages plugin;
i'm using an html5 player which uses this code for the player:
Code: <audio class="AudioPlayerV1">
<source type="audio/mpeg" src="/data/uploads/audio_file.mp3" />
<source type="audio/ogg" src="/data/uploads/audio_file.ogg" />
</audio>
so i set this up as a component and am loading it into the article with dynpages;
i would like to be able to put a placeholder where it says 'audio_file', so that i can use one component and then have it load different audio files by specifying the audio file name in the tag...
thanks in advance for any info on how to do this...i tried to read the instructions about using global arguments, but it seems to use php and since my component doesn't have any php i wasn't sure if this is possible..
Try this:
- Install the DynPages and I18N Custom Fields plugins.
- Go to the Plugins tab in Admin. Create a new custom field:
Name: music_file
Label: Music File
Type: Text field
- Create a theme component. Name it "music_player".
- Enter this for the component's code:
Code: <audio class="AudioPlayerV1">
<source type="audio/mpeg" src="/data/uploads/<?php get_custom_field('music_file'); ?>.mp3" />
<source type="audio/ogg" src="/data/uploads/<?php get_custom_field('music_file'); ?>.ogg" />
</audio>
- Now when you create a page in GetSimple complete the custom field Music File with the filename's name excluding the extension (i.e., song1.mp3 would be "song1").
- In the WYSIWYG editor enter:
This should do it. I think. I haven't tried this I'm just following what I think would be a sequence that would work.
that's a very cool idea; though this would limit you to one audio track per page...thank you for the suggestion!
The plugin I installed are:
I18N 3.0.5 , Dynpages 0.7.2, I18N custom field 1.8.4
I create a component theme called "test" as follow:
<label for="name" label="" style=<?php get_custom_field('mylabel'); ?>>Name</label>
And I create a custom field like this:
Name: mylabel
Label: clear: left;float: left;padding:3px 10px 2px;text-align: right;width: 180px
Type: Long text field
In the WYSIWYG editor I enter this:
{% test %}
But I cannot see the formatting. The get_custom_field didn't work.
I need help
Thanks in advanced
Posts: 6,266
Threads: 181
Joined: Sep 2011
sounds like you problem is custom fields related. did you look at the source to see whats outputting for style?
either way different plugin.
Posts: 14
Threads: 0
Joined: Apr 2013
(2013-04-29, 23:05:50)shawn_a Wrote: sounds like you problem is custom fields related. did you look at the source to see whats outputting for style?
either way different plugin.
It works only with special pages (I18N special pages plugin installed). As follow
I changed the custom field like this:
Name: mylabel
Label: mylabel
Default Value: clear: left;float: left;padding:3px 10px 2px;text-align: right;width: 180px
Type: text value
I entered {% test %} in the WYSIWYG editor of the special page created.
If I would like to insert custom pho code in the WYSIWYG editor, do you know some other solutions?
Thanks in advanced
Posts: 2,094
Threads: 54
Joined: Jan 2011
(2013-04-30, 00:31:52)zintonio Wrote: It works only with special pages (I18N special pages plugin installed). As follow
I changed the custom field like this:
Name: mylabel
Label: mylabel
Default Value: clear: left;float: left;padding:3px 10px 2px;text-align: right;width: 180px
Type: text value
I entered {% test %} in the WYSIWYG editor of the special page created.
It also works with I18N Custom Fields, if you enter the default value in the appropriate field and not the label (see http://get-simple.info/forums/showthread...0#pid35920)
Posts: 3
Threads: 0
Joined: Aug 2013
Hi,
I am desperately needing to use this plugin, however I can't get it to work.
I unzipped the dynpages.php to my plugins directory
It didn't show up in the plugins tab (not sure if its actually supposed to).
I created a component under the theme tab called test
Then through the html editor I added the tag {% test %}
What am I doing wrong?? Thanks in advance.
Posts: 3,491
Threads: 106
Joined: Mar 2010
It should show up in the Plugins page, then you have to activate it (since GS 3.2.x)
Posts: 3
Threads: 0
Joined: Aug 2013
(2013-08-30, 23:36:35)Carlos Wrote: It should show up in the Plugins page, then you have to activate it (since GS 3.2.x)
I am running GS 3.2.3 and the Dynpages doesn't show up in the plugin tab. Any idea why not?
Just to clarify, there's only one php file for this plugin, correct?
Posts: 3,491
Threads: 106
Joined: Mar 2010
(2013-08-30, 23:53:25)eklassen Wrote: I am running GS 3.2.3 and the Dynpages doesn't show up in the plugin tab. Any idea why not?
Just to clarify, there's only one php file for this plugin, correct?
No idea.
Yes, it's just one file, dynpages.php.
What if you try uploading another plugin?
|