WebsiteBaker Community Forum
WebsiteBaker Support (2.12.x) => Modules => Topic started by: CodeALot on February 04, 2020, 12:02:09 PM
-
Hi all. There used to be a solution to add different modules (Bakery, Topics, OneForAll) to the pages.php file in /modules/ckeditor/ckeditor/plugins/wblink
This pages.php-file has changed, and now there is a code block (starting at line 225 in pages.php) that should detect all available modules to build WBLinks from:
"/* --- begin: crawl all available page-addons for additional lists -------------------- */"
This however does not work. I have tested this with a fresh install of OneForAll, but the WBLink plugin fails to detect the pages made by that OneForAll-module.
Like I said: there was a workaround in the old version of CKeditor, but that does not work anymore. Anyone any idea?
-
Additional info: WBLink DOES detect items of a section of the NEWS module.
It fails however to 'detect' OneForAll-records.
-
Never mind. The problem lays deeper than this. It has to do with the new features in WB 2.12.2, like in the announcement:
Added WBLink format [wblink14?addon=news&item=153] to work with addons like news, topics, bakery and so on
It works for News. It does not work for OneForAll.
The link is returned as "#"
For instance, I am on www.mysite.com/pages/home.php
On that page I want to link to page ID 30, which has a OneForAll section. That link should be www.mysite.com/pages/newpage/oneforallitem1.php
<a href="[wblink30?addon=oneforall&item=1]">Linktext</a>
But it results in a link to: www.mysite.com/pages/home.php/#
Looks like it's too complex to solve. I'll work around it.
-
You need to create separate droplet for this. For example [ofa-30] i have this for custom addon..
-
You need to create separate droplet for this. For example [ofa-30] i have this for custom addon..
That would be a workaround, but not for the client. They want to select a page and then a single record. Just like they can do with Bakery, News and Topics-items. It won't work for OneForAll. :-(
-
So either to modify plugin to eork with ofa (easier way) or to create another button in ckeditor for ofa. Either way you must create droplet that create reverse link from [ofa-id] to real link..
-
So either to modify plugin to eork with ofa (easier way) or to create another button in ckeditor for ofa. Either way you must create droplet that create reverse link from [ofa-id] to real link..
True. Can you give me the code for your droplet? I know it's not exactly for my situation, but it may serve as a good starting point :)
-
Hello,
here is solution for OFA.
rename .txt to .php and place to OFA folder
Can someone link this to original topic, https://forum.WebsiteBaker.org/index.php/topic,27895.275.html because its locked.
Also it would be good to include in original OFA module page from WB addon repository
-
Very nice, thank you!
Still work in progress though, I'm afraid.
In CKEditor I now get the dropdown-list with all the OneForAll items, so that is great.
In the source code, I can see how the item is 'called', for instance:
<a href="[wblink23?addon=oneforall&item=27]">OFA item</a>
However, when it's saved, and I check the live page (frontend) and the link is turned into
<a href="#">OFA item</a>
I must add: I use ShortURL. Maybe that's causing problems?
-
Hi, the dialog is now like it should. But the generated link works not for me.
Looks like
<a href="[wblink58?addon=oneforall&item=9]">
In frontend i see as link the same page with a # at the end.
mydomain.de/de/current-page# (yes, with shorturl)
Is there something to do except rename/upload the one file?
-
I will take a look, hovewer i never used OFA module before
-
I will take a look, hovewer i never used OFA module before
Oh man, you should. Can't do without anymore :-) Thanks for your efforts!
EDIT: I installed a fresh WB 2.12.2 without ShortURL and the problem stays as described above here by dbs and me:
In CKEditor source, the link looks ok. In the frontend, the link is replaced by a single "#".
-
This # comes from WbLinkAbstract.php line 119
// set link on failure ('#' means, still stay on current page)
$sRetval = '#';
Seems the following sql query has no result.
-
This # comes from WbLinkAbstract.php line 119
// set link on failure ('#' means, still stay on current page)
$sRetval = '#';
Seems the following sql query has no result.
The same WbLinkAbstract.php is called when you want to link to an item in a News-module, and then it works OK. It fails for OFA, and I can't find why... :(
-
Ok, I now see what's happening. Looking at the output of WbLinkAbstract.php, I get the following:
SQL call for a news post:
SELECT `link` FROM `wb_mod_news_posts` WHERE `post_id`=1
Resulting URL:
/posts/breaking-news-1-1
This works fine.
SQL for an OFA item:
SELECT `link` FROM `wb_mod_oneforall_items` WHERE `item_id`=1
Resulting URL:
/first-item
And that URL is NOT valid since it does not have the full link-path (in this case, it should have been oneforall-page/first-item )
This causes WbLinkAbstract to fail when checking the URL and returning the # instead of the actual link.
-
The source of the problem is the fact that OneForAll does not populate the "link"-field with the actual full link with the /pages/ directory as a base. It only saves the page-url, not the path.
So, the only way to fix this is to alter WbLinkAbstract.php in such a way that:
- The link is checked
- If the link check fails, look for the page_title based on the page_id
- Check if the link exists if you add page_title.'/'. before the link (which will be the case in OneForAll-sections)
...and I can't get that to work properly :-(
-
hello,
In OFA module file , WBReorg.php line 50
const ACCESSFILES_SUBDIR = '';
change to
const ACCESSFILES_SUBDIR = '/ofa'; or whatever ofa item folder is in /Pages
someone test
-
hello,
In OFA module file , WBReorg.php line 50
const ACCESSFILES_SUBDIR = '';
change to
const ACCESSFILES_SUBDIR = '/ofa'; or whatever ofa item folder is in /Pages
someone test
Tested. Does not do anything, it seems.
-
if you have for example OFA item id = 1, what is his real path from /pages direcotry ?? root/pages/ofa/item-link-1.php ?
-
if you have for example OFA item id = 1, what is his real path from /pages direcotry ?? root/pages/ofa/item-link-1.php ?
Correct.
pages/ofa-module-name/titlelink-of-ofa-item.php
What WbLinkAbstract now tries to do, is create
pages/titlelink-of-ofa-item.php
For my own situation, I altered WbLinkAbstract so that it checks for the module name, and if it's the OFA-module name, it adds an extra path to the link
if ($this->oDb->TablePrefix.$this::TABLE_NAME == 'wb_mod_oneforall_items') { $extrapath="oneforall/"; }
$sLink = $extrapath.$sLink;
Not pretty, but it works for me. There should be a more elegant way to solve this, though :-)
-
there are 2 lines in modules/oneforall/WBReorg.php around line 50
/** sub directory for accessfiles
* @description This is needed to correct db::x_mod_table::link entries of former versions<br />
* let it empty without a hardcoded subdirectory name like our news addon with a
* hardcodet subdirectory. The root directory always will be the pages_directory.
* with trailing slash if not empty
*/
const ACCESSFILES_SUBDIR = '';
/** root directory for accessfiles */
protected $sAccessFilesRoot = '';
But no matter if I change to
const ACCESSFILES_SUBDIR = '/ofa';
or
protected $sAccessFilesRoot = '/ofa';
or both of them as /ofa
it want work... Wierd..
-
I got this solution from Jacobi22
Works fine for me...
Try it for yourself and let me/us Know.....
CHEERS
-
Works also for me. Thanks. (Y)
In my case
const ACCESSFILES_SUBDIR = 'de/listen/oneforall';
edit: it works not if you have the same module on another (sub)page.
-
Someone tell me what is difference between
const ACCESSFILES_SUBDIR = '';
And
protected $sAccessFilesRoot = '';
Where are they used.. it seems to me this is same..
But stil, const can not be changed, and
$sAccessFilesRoot could be changed dinamicly ,something like $sAccessFilesRoot = $language.'/ofa/'; right ?
-
I tried the posted WbLink.php and that works, as long as you don't use the same OFA module on different pages.
-
So ine of theese two
const ACCESSFILES_SUBDIR = '';
And
protected $sAccessFilesRoot = '';
Could be array ( different url path for different pages) then to chech if not empty - foreach - chech if php file exists..
-
No idea for dynamically pages dir.
But a question. Can it be, the wblink.php for a ofa with a directory name like "my_ofa" (module name: my ofa) will not work?
Seems the underscore (maybe also the hyphen in /pages/my-ofa) is a problem.
-
No idea for dynamically pages dir.
But a question. Can it be, the wblink.php for a ofa with a directory name like "my_ofa" (module name: my ofa) will not work?
Seems the underscore (maybe also the hyphen in /pages/my-ofa) is a problem.
Can't tell you if that would be a problem. I don't use any hyphens or underscores in module names anymore, just to avoid problems like that :)