Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2008-06-18 10:16:59
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
caption_edit_link
Almost everything is already done. Not by me. No! I think for creating a caption edit link it’s sufficient to change only some attributes in Rob Sables wonderful rss_article_edit in order to catapult the user onto the image tab with the right image already selected. Just, I don’t have the knowledge to do so :-/
There is just one mini function, one line of code that creates the edit link. If it really is as simple as I imagine, would somebody be so kind and post the necessary changes it takes to create a caption_edit_link? :)
Below is the above-mentioned function:
function rss_caption_edit($atts,$thing="") {
global $thisarticle, $rss_ae_cookie;
extract(lAtts(array(
'prefix' => '',
'suffix' => '',
'class' => 'articleedit'
),$atts));
return isset($_COOKIE[$rss_ae_cookie]) ? $prefix.'<a class="'.$class.'" href="'.hu.'textpattern/index.php?event=article&step=edit&ID='.$thisarticle['thisid'].'">'.parse($thing).'</a>'.$suffix : "";
}
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: caption_edit_link
Was thinking about this one my self…
Now that we have <txp:if_privileged>
we could do away with the need for the plugin, right?
Hang on…
Offline
Re: caption_edit_link
mrdale wrote:
Now that we have
<txp:if_privileged>
we could do away with the need for the plugin, right?
Dale, you mean txp:rvm_if_privileged, right?
Offline
Re: caption_edit_link
OK, way out of my depth here, but wouldn’t something like this work?
<txp:rvm_if_privileged>
<txp:php><a href="'.hu.'textpattern/index.php?event=article&step=edit&ID='.$thisarticle['thisid'].'"></txp:php>
<txp:article_image/>
</a>
<txp:else/>
<txp:article_image/>
</txp:rvm_if_privileged>
Last edited by mrdale (2008-06-18 16:32:09)
Offline
Re: caption_edit_link
maniqui wrote:
Dale, you mean txp:rvm_if_privileged, right?
Zackly, you can tell why I suck at scripting. Cleanup is twice as long as the actual coding.
BTW that last chunk of code was a kinda what if… I don’t know php, so feel free to jump in and correct it, cause I’m almost certain it won’t work…
Last edited by mrdale (2008-06-18 16:34:59)
Offline
Re: caption_edit_link
I have no idea what anyone is talking about, but here’s an updated version of mrdale’s PHP:
<txp:rvm_if_privileged>
<txp:php>
$root = hu;
echo <<<EOD
<a href="{$root}textpattern/index.php?event=article&step=edit&ID={$GLOBALS['thisarticle']['thisid']}">
EOD;
</txp:php>
<txp:article_image/>
</a>
<txp:else/>
<txp:article_image/>
</txp:rvm_if_privileged>
Last edited by jm (2008-06-18 19:39:48)
Offline
#7 2008-06-18 20:31:36
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: caption_edit_link
In case I haven’t made my self clear enough: It’s about accompanying the great rss_article_edit tag with its equivalent for images. So if I click the edit link beneath the image I’m taken right to the image tab with the image I want to change caption/alt text/settings for already awaiting me.
Thus, as far as I think, there should be something like this event=image&step=image_edit&id= ...
in the code if it’s about editing the image.
But it’s exactly this point where I’m lost. How do I open the right image? Where can I get the image’s ID?
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: caption_edit_link
uli wrote:
But it’s exactly this point where I’m lost. How do I open the right image? Where can I get the image’s ID?
Yep, those scripts will return edit link to the article. But you don’t need it. Offtopic, but to add, you don’t need any php to do the article edit link:
<txp:rvm_if_privileged><a href="<txp:site_url />textpattern/index.php?event=article&step=edit&ID=<txp:article_id />">Edit article</a></txp:rvm_if_privileged>
To fix that part. But to back to the real uli’s issue: What you use to output the image? Article? Is it an article image? That information is needed, that we know what we should output and where – that we can get the image ID :)
Last edited by Gocom (2008-06-18 20:59:20)
Offline
#9 2008-06-18 21:24:18
- uli
- Moderator
- From: Cologne
- Registered: 2006-08-15
- Posts: 4,306
Re: caption_edit_link
Gocom, thanks! Kind of you ;)
What you use to output the image? Article? Is it an article image?
Already guessed that this will become important. As of now i plan to use it for article images only. But would the link in another form be capable of opening “normal images” as well?
Last edited by uli (2008-06-18 21:24:57)
In bad weather I never leave home without wet_plugout, smd_where_used and adi_form_links
Offline
Re: caption_edit_link
Oh, I must have misread the concept, I was trying to make a front side “image” edit link (as an analog to a frontside “article” edit link).
But I think we’re close to doing that, no?
Offline
Re: caption_edit_link
uli wrote:
As of now i plan to use it for article images only.
Then this should (eh, will) form the complete edit link:
<txp:site_url />textpattern/index.php?event=image&step=image_edit&id=<txp:php>echo $GLOBALS['thisarticle']['article_image'];</txp:php>
So we get:
<txp:rvm_if_privileged><a href="<txp:site_url />textpattern/index.php?event=image&step=image_edit&id=<txp:php>echo $GLOBALS['thisarticle']['article_image'];</txp:php>">Edit the image</a></txp:rvm_if_privileged>
That can be edited to fit your personal tastes. That excepts that you use article id’s inside article image field – plus only one image per article. But that can be modified to support multiple images ect :)
But would the link in another form be capable of opening “normal images” as well?
Requires different kind of script as – well, IDs are served from different ways :)
Last edited by Gocom (2008-06-18 22:06:53)
Offline
Re: caption_edit_link
dont see why this wouldnt work:
<txp:rvm_if_privileged>
<a href="/textpattern/index.php?event=image&step=image_edit&id=<txp:php>echo $thisarticle['article_image'];</txp:php>">EDIT IMAGE</a>
</txp:rvm_if_privileged>
edit: whoops guess im a bit late
Last edited by iblastoff (2008-06-18 22:16:55)
Offline