Can't finish project...

More
6 years 8 months ago #68888 by ggppdk
Replied by ggppdk on topic Can't finish project...
Hello

you can use as custom HTML
Code:
<a href="__item_url__">{item->title} __REL_TEXT__</a>

and then inside category_items.php and item.php out the field like this:

if ( strpos($item->field->display, '/windows/') !==false)
{
echo str_replace('__REL_TEXT__', ' is windows', $item->field->display);
}
elseif ...
elseid ...
else
{
echo $item->field->display;
}


Just if we get layout it will be done only once inside the layout,

about the method you hacked
it will not be overridable directly,

but if we have layouts you could duplicate the method and customize it ... and call your method instead of custom
but it will be some work to do it because the method is now static ! (maybe in future will provide non-static version)

or just use the str_replace and avoid overriding the method


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
6 years 8 months ago #68889 by ggppdk
Replied by ggppdk on topic Can't finish project...
Hello

i have prepared the relation / relation reverse for using layouts

but note that the "FlexicontentFields::getItemsList" will appear inside the layout
but thinking to expose the array of items to layout

$related_items
$related_items[0]->title
$related_items[0]->url
$related_items[0]->rel_html
...
$related_items[1]->title
$related_items[1]->url
$related_items[1]->rel_html
...

and then further custom work on them via str_replace like what you suggest will be easy !!


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

More
6 years 8 months ago #68894 by lipatovroman

you can use as custom HTML


Hi!
This method works not correct.

I added custom HTML



Then I added code to item.php:
Code:
<?php if ( strpos($item->fields["related"]->display, '/windows/') !==false) { echo str_replace('__REL_TEXT__', ' for Windows', $item->fields["related"]->display); } elseif ( strpos($item->fields["related"]->display, '/macos/') !==false) { echo str_replace('__REL_TEXT__', ' for macOS', $item->fields["related"]->display); } elseif ( strpos($item->fields["related"]->display, '/android/') !==false) { echo str_replace('__REL_TEXT__', ' for Android', $item->fields["related"]->display); } elseif ( strpos($item->fields["related"]->display, '/ios/') !==false) { echo str_replace('__REL_TEXT__', ' for iOS', $item->fields["related"]->display); }

but all related items have first replacing:

Please Log in or Create an account to join the conversation.

More
6 years 8 months ago #68895 by lipatovroman
When I use instead elseIf
Code:
<?php if ( strpos($item->fields["related"]->display, '/windows/') !==false) { echo str_replace('__REL_TEXT__', ' for Windows', $item->fields["related"]->display); } if ( strpos($item->fields["related"]->display, '/macos/') !==false) { echo str_replace('__REL_TEXT__', ' for macOS', $item->fields["related"]->display); } if ( strpos($item->fields["related"]->display, '/android/') !==false) { echo str_replace('__REL_TEXT__', ' for Android', $item->fields["related"]->display); } if ( strpos($item->fields["related"]->display, '/ios/') !==false) { echo str_replace('__REL_TEXT__', ' for iOS', $item->fields["related"]->display); } ?>

FC displays extra link with both replacements:

Please Log in or Create an account to join the conversation.

More
6 years 8 months ago - 6 years 8 months ago #68897 by ggppdk
Replied by ggppdk on topic Can't finish project...
Hello

yes it will not work, because HTML of all items is in a single string

anyway i have finished (and mostly tested too)
  • custom layouts for both
    relation and relation reverse
  • added all display options of relation field to relation reverse
  • improved configuration for viewing display to be more clear


the custom layout now contains the HTML per related item
which is then made in the final single display string

thus your replacements will work in a custom layout

this will be available soon


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 6 years 8 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
6 years 8 months ago #68904 by ggppdk
Replied by ggppdk on topic Can't finish project...
Hello

you can now use / test the custom layout for relation / relation reverse fields

please do as soon as possible


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.392 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline