Skip to content

Help needed: $test2 does not work#4943

Closed
math-GH wants to merge 1 commit intoFreshRSS:edgefrom
math-GH:improve-enclosure
Closed

Help needed: $test2 does not work#4943
math-GH wants to merge 1 commit intoFreshRSS:edgefrom
math-GH:improve-enclosure

Conversation

@math-GH
Copy link
Contributor

@math-GH math-GH commented Dec 13, 2022

I need your help:

My general goal: I want to improve the enclosures, that HTML is set in Feed->loadEntries() but it would make sense to have the HTML in normal.phtml.

I added FreshRSS_Entry->content_enclosure and it setter _content_enclosures() and getter content_enclosures().

The issue: with $test (in the constructor) it works, but $test2 (in loadEntries()) it does not work,

How to test:

  1. open an article with an enclosure.
  2. see the print_r() output

It is now:
grafik

Expected behaviour:
Array ( [0] => lo [1] => ad [2] => Ent [3] => ry ) 1

Any help?

@Frenzie
Copy link
Member

Frenzie commented Dec 13, 2022

Isn't that basically local in scope? That is, shouldn't you need something like public $test or $this->test?

Apologies if that's a silly remark; I should head off to bed so I only skimmed it. But in case that's all it is it might suffice to resolve the problem. ^_^

Comment on lines 53 to +57
$this->_title($title);
$this->_authors($authors);
$this->_content($content);
$test = ["cons","truct"];
$this->_content_enclosures($test);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in __construct() the setter _content_enclosures() works

Comment on lines 587 to 591
$entry->_tags($tags);
$entry->_feed($this);
$test2 = ["lo","ad","Ent","ry"];
$entry->_content_enclosures($test2);
$entry->hash(); //Must be computed before loading full content
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this setter _content_enclosures() does not work

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not looked into it. but first test would be to get the content again there.

Either via debugging, writing to a test file, or writing to the logs, which I often do, e.g.:

syslog(LOG_DEBUG, __METHOD__ . ' ' . json_encode($entry->content_enclosures()));

@math-GH
Copy link
Contributor Author

math-GH commented Dec 14, 2022

Isn't that basically local in scope? That is, shouldn't you need something like public $test or $this->test?

Apologies if that's a silly remark; I should head off to bed so I only skimmed it. But in case that's all it is it might suffice to resolve the problem. ^_^

please have a second look on the source code :)

@Alkarex
Copy link
Member

Alkarex commented Dec 14, 2022

By the way, I have a draft of code on my side to save the enclosures when we receive them, and be better able to output them again

@math-GH
Copy link
Contributor Author

math-GH commented Dec 14, 2022

By the way, I have a draft of code on my side to save the enclosures when we receive them, and be better able to output them again

How is there the current status?
To be honest: I am weak in backend development to improve the enclosure system well. I would be able to refactor the HTML code from Feed.php to the phtml templates. I would prefer to use your code ;)

@Alkarex
Copy link
Member

Alkarex commented Dec 14, 2022

@math-GH Here is my draft: #4944
It is not completely finished but almost, and not tested. Tests welcome already.

@Alkarex Alkarex mentioned this pull request Dec 30, 2022
@math-GH
Copy link
Contributor Author

math-GH commented Dec 30, 2022

I close this draft. I go forward with #4944

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants