• New Commercial Services Section

    We have now opened a commercial services section here on the forum. If you have a Fabrik project that you wish to have someone work on for you, post it under Help Wanted. If you are an application developer and wish to earn some money helping others, post your details under Fabrik Application Developers.

    Both of these are unmoderated. It will be up to both parties to work out the details and come to an agreement.

[Solved] How can I create a joomla content_alias from joomla content_title?

Hi,

I want to create a form with Fabrik and I would like to export the fields of my form to the default Joomla content. I want to recreate the Joomla content form with the power of Fabrik. I think that Fabrik and his Textarea Plugin, that can show a field with the maximum numbers of characters left, could be very useful for my clients when they field up their title and metadescription.

So, I had started to note my path by updating this old tread of peamak [HowTo] Submit articles to Joomla and I'm presently stock with the alias table...
peamak said:
- Make "alias" a fabrikcalc (calculation) element, enable "Calc on save only", and enter something like (sorry I did not test that, we can discuss it in this thread if there's a problem):
PHP:
$str = '{jos_content___title_raw}';
$str = strtolower($str);
$str = preg_replace('/( |?|,|;|:|\/|\.|!|\(|\)|"|\')/', '-', $str);
return $str;

So I have installed fabrikcalc and replaced the {jos_content___title_raw} with my own database name but this solution is not working. When I'm creating a new title the alias do not follow, my field stay empty. Also, with this solution, I will have some trouble if my client create 2 articles with the same title... this solution have no protection for two articles with the same alias...

I really tried to solve this on my own, I spent half of my day searching for a solution, I learned a lot but not for this issue :( . Any clue will be appreciated!


P.S. : Sorry for my bad spelling, English is my second language, I will be glad to formulate if I was not enough clear.
 
If you look in ./plugins/fabrik_form/article/article.php, which the plugin which writes a form out to a J! article, around line 488 is this function:

PHP:
    protected function generateNewTitle($id, $catid, &$data)
    {
        // If its an existing article don't edit name
        if ((int) $id !== 0)
        {
            $data['alias'] = JApplication::stringURLSafe(JStringNormalise::toDashSeparated($data['title']));
            return;
        }

        $table = JTable::getInstance('Content');
        $alias = JApplication::stringURLSafe(JStringNormalise::toDashSeparated($data['title']));

        $title = $data['title'];

        while ($table->load(array('alias' => $alias, 'catid' => $catid)))
        {
            $title = JString::increment($title);
            $alias = JString::increment($alias, 'dash');
        }

        $data['title'] = $title;
        $data['alias'] = $alias;
    }

... which is how we do it. So basically we generate a dash-separated, URL safe alias string from the title, then we attempt to $table->load() that alias from the content table. If we can, that means it exists, so we increment the alias (adding a number on the end), and try again, until the $table->load() doesn't find an existing alias.

So you can adapt that code to suit.

-- hugh
 
Hi,

Thanks for your answer! I was looking for this kind of plugin.

So "Fabrik2Article" as been rename "Article form plugin" and with proper setting I can merge articles (joomla content) and fabrik via template and I can also generate an articles (joomla content) from form submission?

In other word I can use some place holders and create a template and I can also link my own fields to a default Joomla content field. Ex : ( my_own_fabrik_title_field ) could be link to the default Joomla content ( xxxx_content_title ) I'm right?

Do I need configure something else to make it work? I'm asking because my setting is half working... I'm able to create a content template, export my templated form inside a Joomla article, but even if I set all my fields from the "Article form plugin" they will not export in a Joomla article fields. So for now I'm not able to achieve a reel exportation.

How did I set Fabrik :

I'm using Joomla! 3.4.3 and I have install "form - Article 3.3.2" from the download section http://fabrikar.com/download/details/36/1382-form-article

At first I went to this wiki, who need to be complete :
http://fabrikar.com/forums/index.php?wiki/article-form-plugin/

I followed this tutorial (who's pretty hidding in the wiki): http://fabrikar.com/forums/index.php?wiki/form-article-plugin-tutorial/&noRedirect=1

Some pictures of my setting :

Joomla! Content manager :

Article-manager.jpg


My elements :

index.php


Fabrik form article plugin - options

index.php


Fabrik form article plugin - fields

index.php



Fabrik form article plugin - images

Fabrik-form-article-plugin-images.jpg
 

Attachments

  • Fabrik-elements.jpg
    Fabrik-elements.jpg
    162 KB · Views: 1,044
  • Fabrik-form-article-plugin-options.jpg
    Fabrik-form-article-plugin-options.jpg
    63.8 KB · Views: 967
  • Fabrik-form-article-plugin-fields.jpg
    Fabrik-form-article-plugin-fields.jpg
    32.4 KB · Views: 1,025
I'll have to do some testing, I haven't used all the fields of an article plugin for a while.

Are any of them working? I have a test form which just uses 'title', and I know that works.

-- hugh
 
Hi,

I also tried on fresh test site, I only have installed Fabrik, Gantry, JCH, Jotcache, no-number cache, and Joomla! 3.4.3. I got the same result for the "Article form plugin" :
  • "Options tab" : (Article template, Category, Reference element, Delete mode) have been test and are working.
  • "fields tab" All the setting are not exporting.
    • I can't see any exportation tab in phpMyAdmin
  • "Images tab" do a tab exportation but do not appear in Joomla! article (front-end and back-end) :
    • In phpMyAdmin I can also see that image field look like this :
      • {"joomlaTest_fb_contact_sample___Intro_img":"","Intro_img":"","joomlaTest_fb_contact_sample___full_img":"","full_img":""}
    • instead of
      • {"image_intro":"","float_intro":"","image_intro_alt":"","image_intro_caption":"","image_fulltext":"","float_fulltext":"","image_fulltext_alt":"","image_fulltext_caption":""}
 
For the fields, can you unset them all except Title, make sure that works. It does for me. I also tested "Meta desc" and that works. Assuming it does work for just Title, start adding the field settings back in one by one, and testing each time. I suspect it may be an issue with an element type for one or more of your fields. For instance, from your screenshot it looks like you are using a 'field' element for the Tags, which I don't think will work, I think it would need to be a Tags element, which is a join to the J! tags table.

-- hugh
 
I have unset all the setting except Title, I it's not working :(
With the same setting I also find out in "Option tab" the "PHP/HTML TEMPLATE" who propose 3 options :
  • debug.php
  • debug_with_labels.php
  • debug_with_title.php
None of them is helping me.

What should I do next?

I will take one more line to say thank you for your help. I really appreciate,it's great knowing that I'm not alone in this solving process!
 
If you fill out your My Sites, give me a backend superadmin login, I'll take a look, it'll be quicker.

-- hugh
 
It's working on my site (in principle, still some issues https://github.com/Fabrik/fabrik/issues/1529): title, alias, author, published, meta,... with the current GitHub.

I've tested with branch reset to Fabrik3.2.3 and can see the missing title, too. It seems there was something fixed meanwhile

So can you update from GitHub to get the latest version?
 
Last edited:
Great, it's working! WOW :D Thank you very much :D

I have play a little bit with the option, I also find out when I setup "article form plugin" that "Tags element plugin" will be exported in "Components > Tags" but will not be exported in default Joomla article.
 
For the images, I have to take a deeper look... I don't want to share falses informations because I misunderstood the setting, but for now :
  • I'm able to export my images from Fabrik form to the J! Article.
  • I can link a default Images
  • I can also create a Thumb
  • I was not able to have a Cropped Image
  • Images can be show in "Fabrik > Forms > View data" but not in J! Article, they will appear broken
  • Images are showing in J! Article but not in "Fabrik > Forms > View data", they will appear broken
Code:
<a href="https://www.xxx.com/images/stories/temp22593381.jpg" rel="lightbox[]" title="temp22593381.jpg">
                <img class="fabrikLightBoxImage" height="100px" src="https://www.xxx.com/images/stories/crop/temp22593381.jpg" alt="temp22593381.jpg">            
</a>

I think that some configuration in "Element Fileupload Plugin", like thumb and crop, can be in conflict with "Article form plugin" and vice-versa, But as I said, I have to look deeper...
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top