"Edit this page" - Printable Version +- GetSimple Support Forum (http://get-simple.info/forums) +-- Forum: GetSimple (http://get-simple.info/forums/forumdisplay.php?fid=3) +--- Forum: Plugins (http://get-simple.info/forums/forumdisplay.php?fid=13) +--- Thread: "Edit this page" (/showthread.php?tid=523) |
"Edit this page" - Carlos - 2010-03-15 Some ideas for having an "Edit this page" button/link in GetSimple live pages (like in Blogger, some WP themes, etc.) 1. Javascript bookmarklet A small JS script that extracts the slug of the current page, then opens 'admin/edit.php?id=...' This one could be useful for editing *any* GetSimple site. Of course it must be "installed" in your browser. 2. In the GS theme Insert this somewhere in template.php: Code: [<a href="admin/edit.php?id=<?php echo return_page_slug(); ?>">edit this page</a>] (this works, it is what I'm using while developing in localhost) 3. Same, but only show button/link if user logged in (CODE DOES NOT WORK ;-)) Code: <?php if(***LOGGED IN***, ) { "Edit this page" - Zegnåt - 2010-03-15 Carlos Wrote:A small bookmarklet that extracts the slug of the current page, then opens 'admin/edit.php?id=...'I’m going to grab some tea first, but will create this one afterwards. Carlos Wrote:Only show button/link if user logged inThere has been talk about this before. But currently there is no way to check whether the user is logged in or not. Edit: I see no fault-proof way for Javascript to know what part of the URL the page’s ID is. I’ll have to think about this a little longer I suppose. "Edit this page" - JWH_Matthew - 2010-03-15 This could be a great set of plugins! It would be pretty easy to set up a cookie that would say there is a user loges in if we could have a plugin hook after the login check but before the redirect is launched? I will work on this later on! "Edit this page" - Carlos - 2010-08-13 I've developed a plugin for this: EditThisPage for GetSimple Note that it is a VERY beta version. Comments, suggestions, corrections... are very welcome, especially about the code. I'm not sure if I'm doing right (with cookies, includes...). If some PHP coder takes a look at the source I'd thank a lot... "Edit this page" - Oleg06 - 2010-08-13 It seems everything is working, thanks, very useful plugin "Edit this page" - daguy - 2010-08-14 Just an idea, Might be great if this could this be added to Blog plugin entries to create a Mini_Blog on steroids Mini Blog right now is more of a really good news Plugin but not really a Blog in my opinion "Edit this page" - ccagle8 - 2010-08-14 Very interesting and useful if you guys could pull it off. I haven't tried to the plugin yet - but this would be great! "Edit this page" - Carlos - 2010-08-15 daguy Wrote:Just an idea, Might be great if this could this be added to Blog plugin entries to create a Mini_Blog on steroids Mini_blog version 0.4: edit mini_blog.php, insert this between lines 153-169 or so (e.g. in line 162, after the post date): Code: if( function_exists('editthispage_check') && editthispage_check() ) { "Edit this page" - dominionit - 2010-09-13 Hi there =-00-0= GS version : 2.01 (stable downloaded) I made a edit page plugin.. but it required me to change 2 files of the GS system. I added a new config option to make cookies site wide. this needs to be added and enabled in gsconfig.php Code: #make Cookies site wide available I also needed to change the cookie_functions.php file. I change the create_cookie and kill_cookie functions. kill_cookie was changed to Code: function kill_cookie($identifier) { and create_cookie was changed to Code: function create_cookie() { and then ALL that needs to be done is the plugin needs to be installed under the plugins dirs. Hope this can help somebody.. Note by default the plugin will not work as they cookie is only available under /admin until the gsconfig.php is changed to enable GSCOOKIEISSITEWIDE I have attached a file with the plugin and the files that was changed. "Edit this page" - Zegnåt - 2010-09-13 Nice one, that might be a function we should start distributing within the core. One nitpick comment though, don’t use: Code: if (defined('GSCOOKIEISSITEWIDE')) Code: if (defined('GSCOOKIEISSITEWIDE')&&GSCOOKIEISSITEWIDE==true) This is something we’ll work on in the core as well, especially with the debug setting which should also be able to be false. "Edit this page" - dominionit - 2010-09-13 Good point, will do so.. Will add when I get home tonight thanks for looking at it. Hope it can help somewhere. "Edit this page" - dominionit - 2010-09-14 Zegnåt Wrote:Nice one, that might be a function we should start distributing within the core. Hi there.. Updated the cookie_functions.php file as per your advise. Attached is the file. Have a nice day. "Edit this page" - El-Cherubin - 2010-10-17 the is a path problem with this plugin. the function is : Code: function content_check($contents){ the problem is here : Code: <a href='admin/edit.php?id=$slug> When you are on a subpage for exemple, the path become mydomain/first-page/subpage/admin/edit.php?... so it's wrong. Maybe in using GSADMINPATH it will be better (cf http://get-simple.info/docs/plugin-creation ) "Edit this page" - dominionit - 2010-10-18 gdsadminpath will give back servers local path to files not the url path. Will check how to handle if subpage as never thought to test on that. thanks will look into it. "Edit this page" - El-Cherubin - 2010-10-18 good Hope you find the solution "Edit this page" - Zegnåt - 2010-10-18 $URL (I think) holds the path to where GetSimple is in the way you want it. Since the above only happens when Fancy URLs are enabled you might want to test for that in your plugin. "Edit this page" - dominionit - 2010-10-18 Thanks. Will look at it else I wrote functions that I use in my common unit that I share between my plugins that figures the url out for me. Might use that and update this plugin as it was before I started writing the url.. It looks as following (sorry english part of brain not working today) Code: function getBaseSiteURLandAddChar(&$baseURL,&$addChar){ "Edit this page" - dominionit - 2010-10-18 Urg... that wont work as the URL is at the client side page and not the admin one. I will have to read the pages files and see if it has parent and build up url for that.. will have to do later first have to finish as Cart system I am doing for somebody now. tx "Edit this page" - Carlos - 2010-10-18 At first I had this same problem with the URL path with my EditThisPage plugin ( http://get-simple.info/forum/post/6074/#p6074 ) You may use global variable $SITEURL, inserting it just before "admin/edit.php?..." -- it will be a full URL instead of a relative one) "Edit this page" - dominionit - 2010-10-18 thanks, will look at.. thank you.. |