Keyword

Get article id

  • Tiago Manuel da Costa Silva
  • Tiago Manuel da Costa Silva's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 7 months ago #81749 by Tiago Manuel da Costa Silva
Get article id was created by Tiago Manuel da Costa Silva
Hi, i´m trying to put a pdf button, how can i get the id of the article i´m in?

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

  • Yiota
  • Yiota's Avatar
  • Visitor
14 years 7 months ago #81750 by Yiota
Replied by Yiota on topic Get article id
How about using something like this: echo JRequest::getInt('id');

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

  • Tiago Manuel da Costa Silva
  • Tiago Manuel da Costa Silva's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 7 months ago #81751 by Tiago Manuel da Costa Silva
Replied by Tiago Manuel da Costa Silva on topic Get article id
Thanks a lot...

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

More
14 years 7 months ago #81752 by Simon Wells
Replied by Simon Wells on topic Get article id
Can you explain a little more about how/where to use echo JRequest::getInt('id'); so others can use it?
Please.

Simon

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

More
14 years 7 months ago #81753 by Simon Wells
Replied by Simon Wells on topic Get article id
Thanks, unfortunate Ning strips out the code ;(
Can you mail to support at k2joom dot com I will take a look and see if I can get that working as well.

Tiago Manuel da Costa Silva said:Of course Simon.
The thing i did is temporary, because what i did was changing the print button for a pdf button.
Later i want to have a new button but i don´t know how to do it yet.
ok.

Procedure:
1º - I edit the file C:\xampp\htdocs\joomla\components\com_k2\templates\default\item.php
2º - I change the original code:




item->printLink; ?>" onclick="window.print();return false;">



item->printLink; ?>" rel="{handler:'iframe',size:{x:900,y:500}}">





For this code:





&lang= ','mywindow','width=800,height=400'
);return false;">




With this code i open the file i want, in my case to make the pdf (oh, I´m using FPDF), then i get the id of the article and the language so i can use $_GET on the "FILE TO OPEN", and print categories and extrafields on the pdf.


I don´t know if it the best way, but is working. Hope this can help.

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

  • Tiago Manuel da Costa Silva
  • Tiago Manuel da Costa Silva's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 7 months ago #81754 by Tiago Manuel da Costa Silva
Replied by Tiago Manuel da Costa Silva on topic Get article id
Sorry for the you can´t see the code, i will send it to you.

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

  • Tiago Manuel da Costa Silva
  • Tiago Manuel da Costa Silva's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 7 months ago #81755 by Tiago Manuel da Costa Silva
Replied by Tiago Manuel da Costa Silva on topic Get article id
Simon, i´m always getting : Sorry, Your uploaded file type is not allowed

How can i send the file to you?

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

More
14 years 7 months ago #81756 by Simon Wells
Replied by Simon Wells on topic Get article id
I have added you as a friend, when you accept, I will send you an email address so that you can email a zip file.

Simon

Tiago Manuel da Costa Silva said:Simon, i´m always getting : Sorry, Your uploaded file type is not allowed
How can i send the file to you?

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

More
14 years 7 months ago #81757 by AdrianK
Replied by AdrianK on topic Get article id
JRequest filters the POST and GET for security reasons and give it back. $_SERVER or $_POST was sended by formulars, get via URL, getint converts the value from string to an integer number. You can you use JRequest everywhere in PHP in a "mounted" Joomla, take a look on joomla docs.

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

  • Tiago Manuel da Costa Silva
  • Tiago Manuel da Costa Silva's Avatar Topic Author
  • Offline
  • Junior Member
More
14 years 6 months ago #81758 by Tiago Manuel da Costa Silva
Replied by Tiago Manuel da Costa Silva on topic Get article id
So, i have replaced the print button code to link me to a file that makes the pdf. I´m using fpdf.
But i need to get a only some extra fields but using $this->item->extra_fields[1]->name;, how can i make my pdf file use this code?

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


Powered by Kunena Forum