Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: [plugin] [ORPHAN] wan_pdf
Hi Wanni,
Just wanted to check back with you about the code snippet for including custom-fields. I think I’ve got everything else working perfectly. This plug-in could really change our whole work flow…Thanks again for the great work.
Cheers,
Tom
Offline
#86 2006-03-28 22:28:32
- wanni
- Archived Plugin Author
- Registered: 2005-11-11
- Posts: 32
Re: [plugin] [ORPHAN] wan_pdf
Hi Tom (and the others of course),
I just forgot the custom field thing and all that, I have to submit my diploma thesis tomorrow, so I ran out of time the last days. Sorry for that, but I will post the snipplet tomorrow (I’ll promise).
Cheers,
Martin
Offline
Re: [plugin] [ORPHAN] wan_pdf
Martin,
Yikes! Diploma Thesis.
No worries at all…take your time…best of luck.
Cheers,
Tom
Offline
#88 2006-04-02 10:18:20
- wanni
- Archived Plugin Author
- Registered: 2005-11-11
- Posts: 32
Re: [plugin] [ORPHAN] wan_pdf
@wmike: I think, you don’t produce valid XHTML, so try to enter debug-mode, take the temporary html-file and put it into the validator .
@renobird: So here is the solution with the custom fields:
Go into the plugin source code and search for
<code>// change image-urls to http://… </code>
<code>$excerpt = str_replace(‘<img src=”/textpattern’, ‘<img src=“http://’.$prefs[‘siteurl’], $excerpt);</code>
<code>$body = str_replace(‘<img src=”/textpattern’, ‘<img src=“http://’.$prefs[‘siteurl’], $body);</code>
and after that you plug in
<code>$c_field1 = safe_field(‘custom_1’,‘textpattern’,‘id = ‘.$thisarticle[‘thisid’]);</code>
Of course you have to replace “custom_1” with the number of the custom field you want to insert. And I also recommend to change the name of the variable regarding to the custom field.
So we got our custom field, we only have to put it into the template. Some lines below you find
<code>fwrite($file, $xhtml_header.”<h1>”.$title.”</h1>\n”.$excerpt.$body.”</body></html>”);</code>
Change this line to put the content of the custom field where you like. Just a little example: In custom field 1 you store the name of the author manually and you want to put this information below the headline, you have to replace this line with
<code>fwrite($file, $xhtml_header.”<h1>”.$title.”</h1>\n”.”<p>Author: “.$c_field1.”</p>\n”.$excerpt.$body.”</body></html>”);</code>
I hope, this will help you.
Last edited by wanni (2006-04-02 10:30:32)
Offline
#89 2006-04-02 14:31:01
- wmike
- Member
- Registered: 2006-01-03
- Posts: 44
Re: [plugin] [ORPHAN] wan_pdf
Hi,
I do create valid code – I take great care to do so & validate all my pages before uploading them – the plugin seems to be pointing to directories that do not exist.
Note. Textpattern renames all images so that they follow a nubered sequence – ie 2.jpg, 3.jpg etc – I don’t know if this is relevant.
Cheers!
Mike
Offline
Re: [plugin] [ORPHAN] wan_pdf
Wanni,
Many, Many Thanks! I’m going to give it a go now.
I’ll send you a link once the site is completed…so you can see all your hard work in action. : )
Cheers Mate.
—
Tom
Offline
Re: [plugin] [ORPHAN] wan_pdf
Hi Wanni,
Gave it a shot….I’m not getting any errors, but it doesn’t seem to pull in the value from the custom field.
It shows the name I give it in the template (your example was “Author”). Here’s the code as I have it.
<code>
$c_field1 = safe_field(‘cost’,‘textpattern’,‘id = ‘.$thisarticle[‘thisid’]);
</code>
“cost” is the name of the custom field I want to include.
Below that in the template:
<code>
fwrite($file, $xhtml_header.”<h1>”.$title.”</h1>\n”.”<p>Cost: “.$c_field1.”</p>\n”.$excerpt.$body.”</body></html>”);</code>
<br/>
I know your busy, and I really appreciate the help…maybe there is something very simple I’m over looking?
Thanks again.
<br />
—
Tom
Offline
#92 2006-04-04 13:04:11
- wanni
- Archived Plugin Author
- Registered: 2005-11-11
- Posts: 32
Re: [plugin] [ORPHAN] wan_pdf
Hi Tom,
in the safe_field expression you don’t have to put in the name of the custom field (in your example ‘cost’) but the number, so it has to be custom_1 for the first field, custom_2 for the second and so on.
Offline
Re: [plugin] [ORPHAN] wan_pdf
Ahh! seems to be working perfectly now. I was over thinking your example.
- )
Thanks again.
—
Tom
Offline
Re: [plugin] [ORPHAN] wan_pdf
This feels like asking a stupid question, but I searched this whole topic twice and couldn’t find the answer.
I’m installing this plugin and the 3rd step is:
create a new style with the name article_pdf and copy & paste the content of the file article_pdf.css into it
But where can I find the file articles_pdf.css; it’s not in the downloads as far as I can see.
Offline
#95 2006-06-11 22:07:58
- wanni
- Archived Plugin Author
- Registered: 2005-11-11
- Posts: 32
Re: [plugin] [ORPHAN] wan_pdf
The file is located in xhtml2pdf.zip
Offline
Re: [plugin] [ORPHAN] wan_pdf
Thanks, it was there indeed.
I unzipped the file in a temp directory that contained already a lot of others files, and therefore didn’t notice it.
(next time: examine the zip, before unzipping!!)
Offline