Passing the url in the entry
Passing the url in the entry
Hi !
I've added a little button below each entry to allow user to send their posts to my social website.
I've added this line in the entries.tpl file :
<a href="http://cgbank.itsartmag.com/submit.php? ... escape:url}" title="Bookmark {$entrydata.title|escape} at CGBank"><img src="cgbank.png" class="socialbkmark" alt="Bookmark {$entrydata.title|escape} at CGbank"/></a><h4 class="serendipity_title"><a href="{$entry.link}">{$entry.title}</a></h4>
I'm not sure it's the right way to pass the Url to my submit script because I've used the way the announcement plugin works.
Is there an easy way to do this ?
Thanks
I've added a little button below each entry to allow user to send their posts to my social website.
I've added this line in the entries.tpl file :
<a href="http://cgbank.itsartmag.com/submit.php? ... escape:url}" title="Bookmark {$entrydata.title|escape} at CGBank"><img src="cgbank.png" class="socialbkmark" alt="Bookmark {$entrydata.title|escape} at CGbank"/></a><h4 class="serendipity_title"><a href="{$entry.link}">{$entry.title}</a></h4>
I'm not sure it's the right way to pass the Url to my submit script because I've used the way the announcement plugin works.
Is there an easy way to do this ?
Thanks
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Passing the url in the entry
Hi!
You need to use $entry instead of $entrydata, when used in entries.tpl
HTH,
Garvin
You need to use $entry instead of $entrydata, when used in entries.tpl
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: Passing the url in the entry
I've modify the code like this :garvinhicking wrote:Hi!
You need to use $entry instead of $entrydata, when used in entries.tpl
HTH,
Garvin
<a href="http://cgbank.itsartmag.com/submit.php? ... escape:url}" title="Bookmark {$entry.title|escape} at CGBank"><img src="cgbank.png" class="socialbkmark" alt="Bookmark {$entry.title|escape} at CGbank"/></a><h4 class="serendipity_title"><a href="{$entry.link}">{$entry.title}</a></h4>
The result link is : http://cgbank.itsartmag.com/submit.php? ... 0Perdersen
The title is good but the Url not and only encoded as a '&'
Any idea ?
Thanks
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Passing the url in the entry
Hi!
Use $entry.link instead of $entry.url. Sorry for forgetting this
Grüße,
Garvin
Use $entry.link instead of $entry.url. Sorry for forgetting this
Grüße,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: Passing the url in the entry
Thanks a lotgarvinhicking wrote:Hi!
Use $entry.link instead of $entry.url. Sorry for forgetting this
Grüße,
Garvin
This time I got this :
/news/archives/737-Picture-Of-the-Week-Altruism-Mathias-Perdersen.html
The first part of the Url (the domain) is miissing and I need it to automaticly submit to my system. I need to add http://www.itsartmag.com in this case.
So is there a variable or a way to catche the complete url with the domain name ?
Cheers
Patrice
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Passing the url in the entry
Hi!
You could try to use the variable {$serendipityBaseURL} prepended to {$entry.link}?
HTH,
Garvin
You could try to use the variable {$serendipityBaseURL} prepended to {$entry.link}?
HTH,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: Passing the url in the entry
Hi !garvinhicking wrote:Hi!
You could try to use the variable {$serendipityBaseURL} prepended to {$entry.link}?
HTH,
Garvin
almosty there
UrL = http://www.itsartmag.com/news/%2Fnews%2 ... Sonata.htm
How to remove the base directory ?
Cheers patrice
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Passing the url in the entry
Hi!
Hm, I think we have no variable for domain name only. In that case, can you simply hardcode your URL into the entries.tpl file?
Regards,
Garvin
Hm, I think we have no variable for domain name only. In that case, can you simply hardcode your URL into the entries.tpl file?
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Re: Passing the url in the entry
Yes I can, but as I was using it on a deployed installation, I was looking for a way to obtain it in a way to not have to change this entry.tpl for each subdomain.garvinhicking wrote:Hi!
Hm, I think we have no variable for domain name only. In that case, can you simply hardcode your URL into the entries.tpl file?
Regards,
Garvin
is there a way to add a variable in the entries.tpl file to obtain the url of the subdomain name without the '/', If so I could add it to the url.link
In fact it works for my subdomain installation but it's a little dirty because I've a path like that :
http://deevad.itsartmag.com//index.php? ... d-art.html
But it works
Patrice
I think Garvin's trying to say that no such variable exists.
That doesn't mean there's no solution, though. I know this is ugly, but try this Smarty in your template:
That should return only the part of the serendipityBaseURL.
That doesn't mean there's no solution, though. I know this is ugly, but try this Smarty in your template:
Code: Select all
{$serendipityBaseURL|regex_replace:"/(http:\/\/[^\/]*\/).*/":"\1"}
Code: Select all
http://domain/Thanks for the help... but it doesn't work It got a strange charater instead of the htt://domain/.. a strange squarejudebert wrote:I think Garvin's trying to say that no such variable exists.
That doesn't mean there's no solution, though. I know this is ugly, but try this Smarty in your template:That should return only theCode: Select all
{$serendipityBaseURL|regex_replace:"/(http:\/\/[^\/]*\/).*/":"\1"}part of the serendipityBaseURL.Code: Select all
http://domain/
Huh. I'll bet the square has ASCII value 0x1.
Right then, try this:
It just replaced the backslash in the replacement string with a dollar sign. Sometimes those work for backreferences, too.
Right then, try this:
Code: Select all
{$serendipityBaseURL|regex_replace:"/(http:\/\/[^\/]*\/).*/":"$1"}
Sorry still doesn't work, I got a blank field.judebert wrote:Huh. I'll bet the square has ASCII value 0x1.
Right then, try this:It just replaced the backslash in the replacement string with a dollar sign. Sometimes those work for backreferences, too.Code: Select all
{$serendipityBaseURL|regex_replace:"/(http:\/\/[^\/]*\/).*/":"$1"}
At this moment I use this : url=
{$serendipityBaseURL}{$entry.link|escape:url}&title={$entry.title|escape:url}&
And here's what I got (it's an example):
url=http://deevad.itsartmag.com/%2Findex.ph ... s%20pearls
In fact it works for me but it's a little dirty I would love to not have this '%2Findex.php%3F%2F' part behind the archives part.
BEst
Patrice
Good gravy, I'm an idiot.
If your serendipityBaseURL doesn't end in a slash, my pattern will do no good whatsoever. In fact, it will return a blank.
Two last things to try, then:
...and the same thing with a \1 instead of $1.
I'm sorry I've been so obtuse. Thanks for persevering with me so long, and I hope this gets it perfect for you.
If your serendipityBaseURL doesn't end in a slash, my pattern will do no good whatsoever. In fact, it will return a blank.
Two last things to try, then:
Code: Select all
{$serendipityBaseURL|regex_replace:"/(http:\/\/[^\/]*).*":"$1"}
I'm sorry I've been so obtuse. Thanks for persevering with me so long, and I hope this gets it perfect for you.