Using variables to reconstruct current URL
-
New Pligger
Using variables to reconstruct current URL
I need to edit my ShareThis code as it is generating incorrect URLs when being shared. e.g.
http://ciagents.com/u/story.php?title=crop-circle-gallery
becomes
http://ciagents.com/u/u/story.php?title=crop-circle-gallery
note that he Pligg base "/u" has been generated twice.
After four hours on the forums, trying AddThis, ShareThis, wading through templates, it seems to me that instead of trying to fix Pligg I can simply override the URL being sent to AddThis using some AddThis variables. But, I cannot find the current story page as a variable. See my example AddThis code below:
<div class="addthis_toolbox addthis_default_style " addthis:url="{$my_pligg_base/}story.php?title={needvariablehere]" addthis:title="{$posttitle} - C!Agents">
Any ideas if there is a $title variable I can grab to get the title or story ID appended to my path to construct a valid URL?
-
Senior Member
If you want to use AddThis, you can use this code:
PHP Code:
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_preferred_1" addthis:url="{$url}" addthis:title="{$title_short}"></a>
<a class="addthis_button_preferred_2" addthis:url="{$url}" addthis:title="{$title_short}"></a>
<a class="addthis_button_preferred_3" addthis:url="{$url}" addthis:title="{$title_short}"></a>
<a class="addthis_button_preferred_4" addthis:url="{$url}" addthis:title="{$title_short}"></a>
<a class="addthis_button_compact" addthis:url="{$url}" addthis:title="{$title_short}"></a>
<a class="addthis_counter addthis_bubble_style" addthis:url="{$url}" addthis:title="{$title_short}"></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=xa-4f31fa424f639a8a"></script>
<!-- AddThis Button END -->
For whatever service you use, just take note of the following variables:
URL: {$url}
Title: {$title_short}
-
New Pligger
Thanks for the reply! The variable $url is the external link URL though, this would allow folks to share the destination URL of the link submitted, not the Pligg post. I'm looking for the URL of the current Pligg page, as it is currently I get the base path twice in any share tool. (I implemented your variable to test this, see ciagents.com/u/)
-
Senior Member

Originally Posted by
mynameismonkey
Thanks for the reply! The variable $url is the external link URL though, this would allow folks to share the destination URL of the link submitted, not the Pligg post. I'm looking for the URL of the current Pligg page, as it is currently I get the base path twice in any share tool. (I implemented your variable to test this, see ciagents.com/u/)
Then use:
PHP Code:
{$my_base_url}{$story_url}
Submitted/External URL: {$url}
Story URL: {$my_base_url}{$story_url}
Title: {$title_short}
-
New Pligger

Originally Posted by
cmstheme
Then use:
PHP Code:
{$my_base_url}{$story_url}
Submitted/External URL:
{$url}
Story URL:
{$my_base_url}{$story_url}
Title:
{$title_short} Thanks for the continued advice! This puts me back to the start of the problem though, as story_url includes _two_ paths to the folder, i.e. I still end up with /u/u instead of /u.
If I can find the variable for the story ID alone, I can simply use
http://ciagents.com/u/$variable_story_id and bypass whatever is forcing the path to replicate itself.
-
Senior Member
That variable is working for me.
May I know your values for:
Base URL
Pligg Base Folder
It seems that those settings are the one affecting it.
-
New Pligger
I haven't edited the defaults which are
Base URL: http://ciagents.com
Pligg Base Folder: /u
Also, I have not enabled htaccess URL rewrites and my SEO settings are at default (URL Method = 1 and Friendly URLs = true)
-
Senior Member
Based on your configuration, you should have:
{$my_base_url} = http://ciagents.com
{$story_url} = /u/story.php?title-url
So, if you used:
PHP Code:
{$my_base_url}{$story_url}
it should be the correct one which is http://ciagents.com/u/story.php?title-url
You can also try this:
PHP Code:
{$my_base_url}{$my_pligg_base}/story.php?title={$title_url}
but I'll prefer the first one.
-
New Pligger
I think the last option is the one that would work, but the title_url is not coming out. I've loaded all the possible variables into a page for review, you'll see what I'm having trouble with. The blanks mean the page is not accessing that variable, i.e. I've asked for the variable and didn't get it. Check this link and look at the top of the title area for a list of variables and the resultant output.
L'Eglise de scientologie condamnee pour escroquerie - LeMonde.fr | C!A Bulletins
Thanks for plugging away at this, seems like a stupid little problem but it's holding me back from committing to Pligg until I can see this is going to work for us.
-
Senior Member
I think I know your problem.
You have to put those codes in link_summary.tpl, not in story_center.tpl because most of the variables are not found in story.php. Just use the page conditional to show it only on the story page.
Similar Threads
-
By ewel in forum Questions & Comments
Replies: 3
Last Post: 04-08-2010, 12:27 PM
-
By mrgekko in forum Questions & Comments
Replies: 6
Last Post: 09-11-2008, 07:58 AM
-
By mrgekko in forum Questions & Comments
Replies: 0
Last Post: 07-29-2008, 03:18 PM
-
By johnsmith in forum Questions & Comments
Replies: 3
Last Post: 03-07-2007, 04:39 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules