GetSimple Support Forum
DynPages plugin - Printable Version

+- GetSimple Support Forum (http://get-simple.info/forums)
+-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3)
+--- Forum: Plugins (http://get-simple.info/forums/forumdisplay.php?fid=13)
+--- Thread: DynPages plugin (/showthread.php?tid=1255)

Pages: 1 2 3 4


DynPages plugin - mvlcek - 2011-01-21

I've created the DynPages plugin (http://get-simple.info/extend/plugin/dynpages/81/) which allows place holders on a page to include a component. It is also possible to pass parameters to the component. As a component can include php-Code, you can thus easily include dynamic fragments on your pages.

For examples see http://mvlcek.bplaced.net/get-simple/dynpages/.

The plugin is similar to the RePlacer plugin, but uses components instead of additional "RePlace" files and allows for parameters passed to the included component.


DynPages plugin - Texta - 2011-03-06

Thanks for this plugin. I'm using it now to avoid having to use the exec_php plugin, because the editor is messing the php code up.

Working nicely so far. But it's not possible to use e. g. "-" in the component name. Took me a while to figure this out.


DynPages plugin - ash - 2011-04-30

mvlcek Wrote:I've created the DynPages plugin (http://get-simple.info/extend/plugin/dynpages/81/) which allows place holders on a page to include a component. It is also possible to pass parameters to the component. As a component can include php-Code, you can thus easily include dynamic fragments on your pages.

For examples see http://mvlcek.bplaced.net/get-simple/dynpages/.

The plugin is similar to the RePlacer plugin, but uses components instead of additional "RePlace" files and allows for parameters passed to the included component.

How can you pass a string with a space as a parameter? I tried both encapsulating it in single or double quotes and it didn't work


DynPages plugin - mvlcek - 2011-04-30

ash Wrote:How can you pass a string with a space as a parameter? I tried both encapsulating it in single or double quotes and it didn't work

In the new version 0.7 you can enclose the parameters in single or double quotes.


DynPages plugin - samrayner - 2011-05-26

Thanks for this plugin mvlcek. One small fix I had to make: your regular expression doesn't match hyphens within component names (only underscores). The default behaviour of Get Simple is to replace spaces in component titles with hyphens, so it'll be quite a common character to appear.

Just changing [a-zA-Z0-9_] on line 42 in dynpages.php to [a-zA-Z0-9_-] did the trick.

Thanks,

Sam


DynPages plugin - andy1228 - 2011-05-26

This plugin is very helpful to me because i can simplify my work, If I want to embed dynamic code,php, forms or javascript on a page I can use this.If i like to change the lay out of my website i can do it as easy as step 1,2,3..great plugin.


DynPages plugin - mvlcek - 2011-05-26

samrayner Wrote:Thanks for this plugin mvlcek. One small fix I had to make: your regular expression doesn't match hyphens within component names (only underscores). The default behaviour of Get Simple is to replace spaces in component titles with hyphens, so it'll be quite a common character to appear.

Just changing [a-zA-Z0-9_] on line 42 in dynpages.php to [a-zA-Z0-9_-] did the trick.

Thanks,

Sam

Thanks for the bug report. I created it for GS 2.03 and the behaviour then was to remove blanks (as far as I can remember).

Fixed in DynPages version 0.7.1.


DynPages plugin - polyfragmented - 2011-06-02

Thanks for this plugin,

I've successfully used it to embed calls of the Simple Page Content plugin within a page itself. No creating a new template or tweaking the default.

Very nice.


DynPages plugin - sal - 2011-06-02

Am I right in thinking this plugin doesn't integrate with I18N Custom Fields out of the box?


DynPages plugin - mvlcek - 2011-06-02

sal Wrote:Am I right in thinking this plugin doesn't integrate with I18N Custom Fields out of the box?
What do you mean? There should be no problems using both of them.


DynPages plugin - sal - 2011-06-06

mvlcek Wrote:
sal Wrote:Am I right in thinking this plugin doesn't integrate with I18N Custom Fields out of the box?
What do you mean? There should be no problems using both of them.
I mean you're not able to use placeholders in custom fields if using both this plugin and I18N Custom Fields. If there was a hook for custom fields you could run your filter on that.

Code:
add_filter('content','dynpages_replace');
add_filter('custom_fields','dynpages_replace');

The reason I actually asked is because I was implementing the I18N Search plugin and found I couldn't use the (% searchform %) placeholder in a sidebar custom field, so the same hook could be used there too, with extra checks for the Custom Fields plugin being present if the hooks system doesn't already account for this.

Code:
add_filter('content','i18n_search_replace');
add_filter('custom_fields','i18n_search_replace');

That said, it's no where near that easy, I'm sure.


DynPages plugin - mvlcek - 2011-07-06

sal Wrote:I mean you're not able to use placeholders in custom fields if using both this plugin and I18N Custom Fields.

I18N Custom Fields version 1.7 calls all content filters for WYSIWYG fields. Thus most plugins replacing place holders should work, as long as they don't also add headers, etc.


DynPages plugin - patriotmedia - 2011-08-09

Mvleck - Do I need any additional plugin to make this work? I've uploaded the dynpages.php file to the plug-in folder, created a "test" component (with simple text-only message), and added:

{% component_name test %}

To my WYSIWYG page content. When I view the page live, I get the placeholder code text above instead of the component content. Is there something I'm missing? All my other plugins are working correctly (only using hitcount and user-management at the moment) and I'm not showing any errors I can see...


DynPages plugin - polyfragmented - 2011-08-09

Replace component_name with test and it should work flawlessly :-)

{% test %}


DynPages plugin - patriotmedia - 2011-08-09

polyfragmented Wrote:Replace component_name with test and it should work flawlessly :-)

{% test %}

Yep. Thanks! I knew I was working too late at night again...


DynPages plugin - alienee2 - 2011-10-30

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..


DynPages plugin - jyoz22 - 2011-10-30

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:

Code:
{% music_player %}

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.


DynPages plugin - mvlcek - 2011-10-30

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..

Just create the component (named "music_player") as:
Code:
<?php global $args; ?>
   <audio class="AudioPlayerV1">
          <source type="audio/mpeg" src="/data/uploads/<?php echo $args[0]; ?>.mp3" />
          <source type="audio/ogg" src="/data/uploads/<?php echo $args[0]; ?>.ogg" />
    </audio>
and call it from your page with e.g.
Code:
(% music_player beethoven_eroica %)



DynPages plugin - alienee2 - 2011-10-31

mvlcek 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..

Just create the component (named "music_player") as:
Code:
<?php global $args; ?>
   <audio class="AudioPlayerV1">
          <source type="audio/mpeg" src="/data/uploads/<?php echo $args[0]; ?>.mp3" />
          <source type="audio/ogg" src="/data/uploads/<?php echo $args[0]; ?>.ogg" />
    </audio>
and call it from your page with e.g.
Code:
(% music_player beethoven_eroica %)

OK, thanks so much for the code!....though for some reason this is not working.... when the page renders, it is not putting in the argument, so the file path is looking like /data/uploads/.mp3

-marc


DynPages plugin - mvlcek - 2011-10-31

Correction: you need to use curly brackets:
Code:
{% music_player beethoven_eroica %}



DynPages plugin - alienee2 - 2011-10-31

mvlcek Wrote:Correction: you need to use curly brackets:
Code:
{% music_player beethoven_eroica %}

even with the curly brackets, the variable doesn't get inserted... still shows as /data/uploads/.ogg


DynPages plugin - mvlcek - 2011-10-31

alienee2 Wrote:
mvlcek Wrote:Correction: you need to use curly brackets:
Code:
{% music_player beethoven_eroica %}

even with the curly brackets, the variable doesn't get inserted... still shows as /data/uploads/.ogg

If you did get the <audio ...> code with (% music_player beethoven_eroica %), you are confusing something - this can't happen.
Are you sure you are testing the correct page - and not a page with just {% music_player %} on it? For me it works perfectly.


DynPages plugin - alienee2 - 2011-10-31

Here is the component code:

Code:
<?php global $args; ?>
   <audio class="AudioPlayerV1">
          <source type="audio/mpeg" src="/data/uploads/<?php echo $args[0]; ?>.mp3" />
          <source type="audio/ogg" src="/data/uploads/<?php echo $args[0]; ?>.ogg" />
    </audio>

and the component is called audio-player
the audio files are named sleepers_awake.mp3 and sleepers_awake.ogg

Here is the tag i'm using:

Code:
{% audio-player sleepers_awake %}

here is the url where i'm using the code: http://www.weddingmusicensembles.com/

the first player is the one using this code, and the output is looking like this:

Code:
<audio class="AudioPlayerV1">
          <source type="audio/mpeg" src="/data/uploads/.mp3" />
          <source type="audio/ogg" src="/data/uploads/.ogg" />
    </audio>

the subsequent players are each using a separate component where the audio file path is part of the component...

thanks again for your help...not sure why this isn't working for me....


DynPages plugin - alienee2 - 2011-10-31

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:

Code:
{% music_player %}

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!


DynPages plugin - mvlcek - 2011-10-31

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...