Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DynPages plugin
#76
(2016-03-03, 22:02:49)linden Wrote: Is it possible to use this plugin for rendering a component together with i18n-specialpages? I mean it does work if i use for example (% component %) in the specialpage content. But would want to create a specialpage with new field, type "wysiwyg" and render the component in that field. Is this possible? Not sure if i am explaining well enough Smile

Nope, I suppose it's not explained well enough.

If you wanted to
  • create a special page type with an additional WYSIWYG field, e.g. 'wysiwyg'
  • and code to display both this field and the regular content (special page type tab 'view', text area 'HTML/PHP code for the display of a page'), e.g.
Code:
<div><?php get_special_field('wysiwyg'); ?></div>
<div><?php get_special_field('content'); ?></div>

you would have
  • created such a special page type,
  • created a test special page, e.g. with the following in the additional WYSIWYG field (note the curly braces for dynpages)
Code:
Test component: {% mycomponent %}
  • viewed the page
  • and seen that the component 'mycomponent' was correctly displayed

So please try to better explain what you want to achieve.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#77
Yes that was pretty much what i wanted to achieve. And i have done just as you said. But it will only render if i put the shortcode into the "page content" of the page but not if i put the shortcode in the specialpage wysiwyg field. 

Using {% mycomponent %} into the both fields:

<?php get_page_content(); ?> Works and renders the component

<?php get_special_field('wysiwyg'); ?> Does not render the component

Any idea what i am missing?
Reply
#78
Two general questions (having to do with i18n, components, dynpages):
1. In my understanding, components are like pages. Especially with dynpages you include them with a shortcode {% mycomponent %}
So, they are not theme-specific, in that they are not switched out if you change theme. Correct me if I am wrong.
There doesn't seem to be a need for theme-specific components anyway, since they usually contain code and can be put in the template as php, js, etc., and called from there at will.
1b. Where would you put supporting files for (site-wide) components? Is it consistent with the GS philosophy to put them into data/uploads/...?
The reason I am asking here and elsewhere, is that with GetSimple it is not generally useful to switch themes and still expect the new theme to sensibly display the same site. There are a few things such as Sidebar, tagline, header, footer, that seem to get some support out of the GS box, but I feel more can be done. The question is: should the matter be addressed by GS, some plugin, or some generally accepted techniques that GS already provides th hooks for (that I am not aware of as a relative newbie with a shallow knowledge of js, php, css)
2. Can you have a component 'mycomponent' and 'mycomponent_fr' where one will be called when the current language is French?
Reply
#79
(2016-12-01, 23:47:40)vanfruniken Wrote: 1b. Where would you put supporting files for (site-wide) components? Is it consistent with the GS philosophy to put them into data/uploads/...?

I'd probably put js, css, etc. into a theme/common directory and other files like pdfs into data/uploads.

(2016-12-01, 23:47:40)vanfruniken Wrote: 2. Can you have a component 'mycomponent' and 'mycomponent_fr' where one will be called when the current language is French?

yes, with the I18n plugin: get_i18n_component.
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#80
Thanks, mvlcek
Reply
#81
hi,

i installed dynpages successfully - i use it on a blog page for blog posts of one certain category. it worked for about 30 minutes, then suddenly the page is showing all blog posts with all categories and xdebug is throwing the following errors:

[Image: xdebug-dynpages-category-page.png]

can you give me a hint on what causes the problem?
Reply
#82
This is one of the most useful plugins. I have a problem whereby CKEditor adds hard spaces (sometimes) so the $args passed to the component are therefore interpreted incorrectly. Could someone advise as to what the preg_match string should be to find any number of spaces and any number of &nbsp;
Reply
#83
Hi,
As with GetSimple 3.3 this plugin produces "error" on activating. Isn't it supported anymore?
Thanks und rgds
leda
Reply
#84
Works for me. Just tested Dynpages 0.7.2, GS 3.3.15
I suggest you enable GSDEBUG or check your errorlog.
Reply
#85
Hi Carlos,

Thanks for your quick answer :-)

It _may_ have to do with the fact, that I'm newly am running and testing GetSimple on a local IIS, as I never suffered from this using XAMPP.
Oddly enough, after reboot and cleaning all available caches it started working... don't know, some hiccup.

All OK!
Reply
#86
Currently "Dynpages" returns an empty string when the it can't find a component.

This happened to me because I actually need to display values that look similar to the values that "Dynpages" is looking to replace.

To deal with this I updated my copy of the plugin so that it will return the original string if it could not find a component.

I replaced ...
=====================
ob_start();
if (function_exists('get_i18n_component')) {
get_i18n_component($match[2]);
} else {
get_component($match[2]);
}
$replacement .= ob_get_contents();
ob_end_clean();
=====================
with ...
=====================
ob_start();
$foundKey = null;
if (function_exists('get_i18n_component')) {
$foundKey = get_i18n_component($match[2]);
} else {
get_component($match[2]);
}
$newContent = ob_get_contents();
ob_end_clean();

if ($foundKey or !empty($newContent)) {
$replacement .= $newContent;
} else {
// Key not found. Return original for debug or content.
// Sometimes it is just valid content.
return $match[0];
}
=====================

Any feedback welcome.

Thanks.
Reply
#87
Hello,
I guess there is something I am missing about DynPages.

So, I installed the plug-in.
On my GS Page, I make a call to a component :
{% helloworld %}

I created a component calle helloworld.
<?php echo "hello world"; ?>

This works and displays "hello world" in the page.

My problem is with arguments, I try to pass arguments.

I modify the component like this : <?php echo "hello world $args[0]"; ?>
I make a call like this in the page {% helloworld humans %}

My expectations is to see : "hello world humans"
but I have "hello world".

What I am missing ? Thanks for any help.

------

EDITED :
I managed to solve it myself.

Do not forget to redefine the variable as a global variable in the component.

<?php
global $args;
echo "hello world $args[0]";
?>
Reply
#88
Happy New Year 2023, dear GS Admins, programmers and users!
I want to call special pages with a tag assaigned by "select" custom field in several place on a page.

So, let's say I create special pages and assign tags "january", "february", etc. by "select" custom field and indexed as "tags".

And then I create a component "call-by-month" with code:
PHP Code:
<?php
global $args;
get_i18n_search_results(array('tags'=>$args,'words'=>' ','max'=>5,'numWords'=>10,'HEADER'=>null));
?>


And with my DynPages plugin enabled I need to use the the component with specific tag parameter to call relevant posts:

Code:
<h2>January</h2>
(% call-by-month january %)

<h2>February</h2>
(% call-by-month february %)

What else is missing to make it working?
Reply




Users browsing this thread: 1 Guest(s)