Selecting articles / categories for PDF

Phoca PDF - creating PDF documents in Joomla! CMS
rbuelund
Phoca Professional
Phoca Professional
Posts: 115
Joined: 22 Mar 2015, 00:18
Contact:

Selecting articles / categories for PDF

Post by rbuelund »

It seems that the "Include Articles" setting overrules the "Include Article Categories" ??

I would like to show the PDF options on some articles across different categories, and I would like to show the PDF option for all articles in some other categories (Not selected single articles included in this particular category) - is that not possible ??

Tags:
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Selecting articles / categories for PDF

Post by Jan »

Hi, both parameters work the same way:

- if you exclude article and Phoca PDF gets ID of article and sees, it is excluded, then the PDF is not displayed
the same for category:
- if you exclude category and Phoca PDF gets ID of category and sees, it is excluded, then the PDF is not displayed

Article rule applies first but in fact this has no influence on the feature. Even if this will applied as second, it will work the same.

Jan
If you find Phoca extensions useful, please support the project
rbuelund
Phoca Professional
Phoca Professional
Posts: 115
Joined: 22 Mar 2015, 00:18
Contact:

Re: Selecting articles / categories for PDF

Post by rbuelund »

I do not use Exclude I only use include as I wrote. But I still do not see the PDF button in the articles of the included category??
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Selecting articles / categories for PDF

Post by Jan »

Hi, sorry for misunderstanding. Yes, in this case, article is the priority but it only applies when the parameter has some data. If not, it is ignored. So it does not influence category.

Try to disable SEF and check if the category ID in URL address is really same as the one set in parameters. :idea:

Jan
If you find Phoca extensions useful, please support the project
rbuelund
Phoca Professional
Phoca Professional
Posts: 115
Joined: 22 Mar 2015, 00:18
Contact:

Re: Selecting articles / categories for PDF

Post by rbuelund »

It is the same category in the URL catid=121 which is set in the PDF settings. The PDF button IS shown on the articles whos ID I have set, but NOT on articles from this category.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Selecting articles / categories for PDF

Post by Jan »

Hi, now I understand, If you have set some IDs for article include, all others will be ingored and this happens befor it checks the category ID.

So then the only way is to customize the code directly:
administrator/components/com_phocapdf/helpers/phocapdf.php function getPhocaPDFContentIcon

and change the behaviour there :idea:

Jan
If you find Phoca extensions useful, please support the project
rbuelund
Phoca Professional
Phoca Professional
Posts: 115
Joined: 22 Mar 2015, 00:18
Contact:

Re: Selecting articles / categories for PDF

Post by rbuelund »

That is sad - could this not be implemented in the future? So that it both takes full categories and seperate articles from other categories ? So that the category field overrides the article field - wouldn't that make sense ?
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Selecting articles / categories for PDF

Post by Jan »

Hi, do you know PHP? If you are able to set the rules differently, just let me know the code, so I can implement it in next version. The problematic part is, that it depends on specific using of this feature. For someone will be important to check the articles first, for someone to check the categories first :idea:

Jan
If you find Phoca extensions useful, please support the project
rbuelund
Phoca Professional
Phoca Professional
Posts: 115
Joined: 22 Mar 2015, 00:18
Contact:

Re: Selecting articles / categories for PDF

Post by rbuelund »

Line 51 and on change to:

Code: Select all

		$include_article = true;
		$include_category = true;
		
		if (!empty($include_articles)) {
			if(isset($item->id) && !in_array($item->id, $include_articles)) {
				$include_article = false;
			}
		}

		if (!empty($include_categories)) {
			if(isset($item->catid) && !in_array($item->catid, $include_categories)) {
				$include_category = false;
			}
		}
		//If neither article id nor category id is included return ""
		if(!($include_article || $include_category)){return "";}
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48386
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Selecting articles / categories for PDF

Post by Jan »

Hi, great, thank you, please test and let me know:

https://github.com/PhocaCz/PhocaPDF/rel ... 0Beta4.zip

Jan
If you find Phoca extensions useful, please support the project
Post Reply