Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Simple Input Tabs
#76
I am really looking forward to trying this plugin out. Is version 1.x pretty much in it's final form now, tested, approved and recommended?
Reply
#77
(2012-11-11, 06:18:19)jason.dixon.email Wrote: The empty paragraph is intentional. Otherwise you end up typing in Header 1 size after deleting everything.

Maybe.

(2012-11-11, 06:18:19)jason.dixon.email Wrote: You can turn off the content not found error currently. ... I'll need to make sure that it doesn't save that default text though.

A saved empty tab is pre-filled with the default text (either the plugin built-in default or the optional parameter) on next edit and, yes, it's saved and rendered.

(2012-11-11, 06:18:19)jason.dixon.email Wrote: I'll check that out. If it outputs nothing (ie no error) though, isn't that enough to get a true/false reading?
EDIT: You can use return_tab_content("tabname"); to get the content already. I imagine this would also work to check if content exists or not:
Code:
<?php if(return_tab_content("mytab")){ echo "Content exists!"; } else { echo "There is no content."; } ?>
No output doesn't necessarily give false: I have come unstuck with GS when an empty array was returned, for example. No output, but not nothing returned.

In fact, (return_tab_content( ... )) on an empty tab returns the string "There was a problem with your Tab request.", which is, of course, True.

One other snag I found today, is that this code breaks SIT:
PHP Code:
<?php insert_page_content('tabone');
insert_page_content('tabtwo'); ?>

Only the first instance is recognised. This alternative works as expected:
PHP Code:
<?php insert_page_content('tabone'); ?>
<?php insert_page_content
('tabtwo'); ?>

Also, SIT does not understand PHP comments, so this will still show a tab:
PHP Code:
<?php //insert_page_content('tabone'); ?>

In a combination of these points, this will show tab tabone, but not tabtwo:
PHP Code:
<?php //insert_page_content('tabone');
insert_page_content('tabtwo'); ?>

That nearly drove me round the bend before I found out !

(2012-11-11, 23:10:01)Timbow Wrote: I am really looking forward to trying this plugin out. Is version 1.x pretty much in it's final form now, tested, approved and recommended?

It's a good idea and it's entirely usable right now. It will improve with a bit of maturity, no doubt.
--
Nick.
Reply
#78
(2012-11-11, 23:10:01)Timbow Wrote: I am really looking forward to trying this plugin out. Is version 1.x pretty much in it's final form now, tested, approved and recommended?
Yeah, though I'm pretty-fying it with javascript at the moment. Not too far off putting out version 1.9 which has a bunch of little fixes and some new warning messages etc to make things easier for users.

Then I'm thinking in 2.0 I'll make a proper configuration screen.

(2012-11-12, 04:56:17)hameau Wrote: A saved empty tab is pre-filled with the default text (either the plugin built-in default or the optional parameter) on next edit and, yes, it's saved and rendered.

Yeah I'm working on this one now. Should be sorted next upload. Smile

Quote:No output doesn't necessarily give false: I have come unstuck with GS when an empty array was returned, for example. No output, but not nothing returned.

In fact, (return_tab_content( ... )) on an empty tab returns the string "There was a problem with your Tab request.", which is, of course, True.

Yeah my bad with that error message. Angel
I may be a little overzealous in putting error messages everywhere.
You can be sure though, that an empty tab request will not give you anything other than a string of characters or NULL. But I can probably make it return "false" if it finds nothing to be extra sure.

EDIT: Actually as a side note, that specific error "There was a problem with your Tab request." comes up when your tab 'request' is wrong. ie: wrong syntax. That is likely because that request tab only accepts the "specific" style syntax. Or in other words using an -> in the string. Trying your tab request with an arrow might work:
Code:
return_tab_request("->mytab");
In any case, I have changed this to work more normally. So it will work just the same as insert_page_content does, but returning info.

Quote:One other snag I found today, is that this code breaks SIT:
PHP Code:
<?php insert_page_content('tabone');
insert_page_content('tabtwo'); ?>

Only the first instance is recognised. This alternative works as expected:
PHP Code:
<?php insert_page_content('tabone'); ?>
<?php insert_page_content
('tabtwo'); ?>

Also, SIT does not understand PHP comments, so this will still show a tab:
PHP Code:
<?php //insert_page_content('tabone'); ?>

In a combination of these points, this will show tab tabone, but not tabtwo:
PHP Code:
<?php //insert_page_content('tabone');
insert_page_content('tabtwo'); ?>

That nearly drove me round the bend before I found out !

Haha, sorry. That would be the fault of my regular expression:
Code:
/<\?php.*?\binsert_page_content\(([^)]*?)\);?.*?\?>/si
I was kinda hoping that there would be one function call per php tag, and commenting out the code slipped my mind. Tongue
Looks like I need to update it.

Thanks for this feedback, again! It's really helpful.

And p.s. if anyone reading this is particularly good with reg expressions take a look at this one and give me some pointers? Smile
Reply
#79
(2012-11-12, 07:50:11)jason.dixon.email Wrote: Yeah I'm working on [saving empty tab] now. Should be sorted next upload. Smile

Good!

(2012-11-12, 07:50:11)jason.dixon.email Wrote: You can be sure though, that an empty tab request will not give you anything other than a string of characters or NULL. But I can probably make it return "false" if it finds nothing to be extra sure.

EDIT: Actually as a side note, that specific error "There was a problem with your Tab request." comes up when your tab 'request' is wrong. ie: wrong syntax. That is likely because that request tab only accepts the "specific" style syntax. Or in other words using an -> in the string. Trying your tab request with an arrow might work ...

I'm just nervous of using NULL as False ... Yes, the alternative syntax works.

(2012-11-12, 07:50:11)jason.dixon.email Wrote: And p.s. if anyone reading this is particularly good with reg expressions take a look at this one and give me some pointers?

I feel a bit mean pushing this plugin beyond its advertised capabilities. Perhaps it would be better to document its limitations (after all, it works very well for its intended purpose) and let it gain more widespread use before adding more functionality? Otherwise it will snowball beyond all recognition (and maintenance).

The commented function call problem is only significant during (template) development and it's easy enough to also (for example) change an underscore for a hyphen to hide the call. Similarly, just document that each function call must be surrounded by its own <?php ... ?> tags.

Good work !
--
Nick.
Reply
#80
(2012-11-13, 02:41:59)hameau Wrote: I feel a bit mean pushing this plugin beyond its advertised capabilities. Perhaps it would be better to document its limitations (after all, it works very well for its intended purpose) and let it gain more widespread use before adding more functionality? Otherwise it will snowball beyond all recognition (and maintenance).

The commented function call problem is only significant during (template) development and it's easy enough to also (for example) change an underscore for a hyphen to hide the call. Similarly, just document that each function call must be surrounded by its own <?php ... ?> tags.

Good work !

The things you've mentioned are not really features, otherwise I would agree. Just refinements. And nearly all of them I have resolved in this next upload. Tongue
Having trouble with the multiple tag thing, though currently it should work with multiple tags under one php tag provided they are on the same line.

Here is the current state of the plugin. You're doing a great job putting it through its paces if you want to give it a run. Smile
Reply
#81
Edit: this is v1.9.

(2012-11-13, 03:37:52)jason.dixon.email Wrote: Having trouble with the multiple tag thing, though currently it should work with multiple tags under one php tag provided they are on the same line.

I can't get this to work at all. Tried two function calls (different tab names) on the same line, on adjacent lines, with/without whitespace between them: nothing. The fields are recognised in the 'Preview' but only the first call generates a tab on the Edit page.

Comment marks are honoured in the 'Preview', but ignored on the Edit page (tabs appear for commented calls).

(I only tried Firefox & Chromium in Linux.)

Empty tabs are saved as such and the auto-inserted text is not saved unless changed. Smile (Not the case for 'Main', but that's not unreasonable!)

This code:
PHP Code:
<?php if (return_tab_content('->sidebar')){
  
insert_page_content('sidebar');
} else {
  
insert_page_content('index->sidebar');
?>
doesn't give me a tab for 'sidebar' (Edit page) and shows a position marked 'Index' on the preview. The logic works fine with whatever is already saved in the page. It's getting complicated ...
--
Nick.
Reply
#82
I am having a go with v1.8f .

I have a fresh new vanilla installation of GS using the std Innovation Theme. I want to use this plugin to make the sidebar content editable on a tab and through the wysiwyg editor.

How would I do that? (I have tried).
Reply
#83
(2012-11-13, 21:43:12)Timbow Wrote: I have a fresh new vanilla installation of GS using the std Innovation Theme. I want to use this plugin to make the sidebar content editable on a tab and through the wysiwyg editor.

'Cardinal' would be a better bet for initial experimenting as it's organised in a much more straightforward manner.

'Innovation' has a problem as it relies on the sidebar script being included at runtime, which doesn't happen when editing. You need to move the contents of theme/Innovation/sidebar.inc.php (from <aside> to </aside>, inclusive) to the main template.php file, in place of <?php include('sidebar.inc.php'); ?>.

Now edit this revised theme/Innovation/template.php and replace
Code:
<?php get_component('sidebar');    ?>

with
Code:
<?php insert_page_content('sidebar'); ?>

and also replace
Code:
<?php get_page_content(); ?>

with
Code:
<?php insert_page_content(); ?>

That should be it. The 'sidebar' component then becomes redundant and all content is entered/edited in the tabs.
--
Nick.
Reply
#84
Changes 1.9. Fixed a bug where changing tabs while in source mode would cause the same data to be saved in all tabs. Now you cannot change tabs while in source mode. Tongue

returntabdata(); now also accepts non-specific tab requests (ie: without the ->) and removed the "tab problem" error. If returntabdata() cannot find any data, it will now return false.

Added a content lock that will prevent access to the content while a page title hasn't been entered or the template has changed prior to the page being saved.

Tabs should no longer save the default content.

Added a new config option to stop the display of default content on new pages.

Added some new dynamic errors on the page edit screen.

Using tab specific requests in insertpagecontent (ie: with ->) will now accept plugins content filter. However insertpagecontent now has a new true/false parameter to turn off the content filter per tab: insertpagecontent($tab,$blurb,false);

Removed the 'active-tab' config option and replaced it with an "active-tab" class on to be style able style in CSS. MAy need to use !important to ensure your style is displayed on tab.

Fixed a bug where multiple insert_page_content calls within one set of php tags would not all work. Commented out or otherwise inactive insert_page_content calls will now be ignored.

Added a new phrase to the language file = SOURCE_MODE. So if you're using an 'external' language file, be sure to update it.

(2012-11-13, 21:43:12)Timbow Wrote: I am having a go with v1.8f .

I have a fresh new vanilla installation of GS using the std Innovation Theme. I want to use this plugin to make the sidebar content editable on a tab and through the wysiwyg editor.

How would I do that? (I have tried).

What Hameau said sounds about right. Big Grin
Reply
#85
Hey Jason, looks as though everyone is keeping you quite busy with SIT.
Here is an updated Spanish translation that you can add to the lang folder, and remove from "simple_input_tabs.php" on your next release. Should make for easier updating later on, and helps keep extra junk out of the plugin itself.


GS Community Edition with php8.x compatibility, new features and much more!  Support Me


Reply
#86
(2012-11-14, 06:45:58)islander Wrote: Hey Jason, looks as though everyone is keeping you quite busy with SIT.
Here is an updated Spanish translation that you can add to the lang folder, and remove from "simple_input_tabs.php" on your next release. Should make for easier updating later on, and helps keep extra junk out of the plugin itself.

Busy? You aren't kidding, haha. All good though. I'm pretty happy with how far this plugin has come.

Awesome. I'm still of two minds about dropping internal language entirely. It's nice having a single file that just works, but I'll add this translation to the folder. Smile
Reply
#87
(2012-11-14, 08:46:21)jason.dixon.email Wrote: Awesome. I'm still of two minds about dropping internal language entirely. It's nice having a single file that just works, but I'll add this translation to the folder. Smile

If you prefer to keep it in the file its self, just copy over the new info. I dont know if I am the only one who uses this in another lang? Blush

Either way, its updated for anyone else who might be interested, and ready for whichever way you decide to go with it.

Thanks for all the time devoted on this cool plug.


GS Community Edition with php8.x compatibility, new features and much more!  Support Me


Reply
#88
When I'm using the java-tab after saving I'm having empty tabs or both pages having the same content.

Or even this as content in the main tab:
{"Main":"

\n\tthis is the main content

\n","Sidebar":"Add your content to the section: Sidebar"}

Using the button-tabs everything works fine,
so something goes wrong in storing the content within the javascript?
<º)))><
Reply
#89
(2012-11-16, 04:09:15)uitdecom Wrote: so something goes wrong in storing the content within the javascript?

Not intended. Huh

Hmm... Is it always saving nothing or just sometimes? Are you using the default CKeditor, and what plugins might you also be having?

Also yeah, the button tabs should be pretty rock solid when it comes to reliability. They use nothing other than php which seems a lot less fickle. Tongue
Reply
#90
Always, tried a clean install as well and had the same problem.

Could it be something to do with utf8/html entities?

And yes, the button tabs are working great!
(So client will be filling up his site this weekend.)
<º)))><
Reply
#91
(2012-11-16, 19:20:58)uitdecom Wrote: Always, tried a clean install as well and had the same problem.

Could it be something to do with utf8/html entities?

And yes, the button tabs are working great!
(So client will be filling up his site this weekend.)

Shouldn't be a problem with html entities as they are converted using Jquery (unless there is a problem with Jquery, but it's working fine for me).

There was one thing I removed from Javascript tabs as it seemed redundant, but maybe it wasn't? Can you try this version if you haven't already: Old version 1.8f.

See if it causes the same issues. Also which browser are you using?
Have you been able to reproduce any steps leading to stuff not being saved correctly? I haven't been able to reproduce it yet. Sad
Reply
#92
No, same problem (Firefox & Chrome) with both versions.

after saving main tab displays: {"Main":" \n\tmain content txt \n","Sidebar":" \n\tAdd your content to the section: Sidebar \n"}
other tab just the 'Add your content ... ' empty tab message.

It is working fine at my local setup. Seems to be something I need to change on the server.

//gonna try it on a different providers server, only way to find out I guess
<º)))><
Reply
#93
(2012-11-16, 21:30:04)uitdecom Wrote: No, same problem (Firefox & Chrome) with both versions.

after saving main tab displays: {"Main":" \n\tmain content txt \n","Sidebar":" \n\tAdd your content to the section: Sidebar \n"}
other tab just the 'Add your content ... ' empty tab message.

It is working fine at my local setup. Seems to be something I need to change on the server.

//gonna try it on a different providers server, only way to find out I guess

Can you try this on your problem system and let me know if it works? Find this section of code:

Code:
function SIT_save_file(){
global $xml, $url;//
Around line 689, I think. Then on a line just under here somewhere, paste this:


Code:
if (get_magic_quotes_gpc()){$_POST['old-page-content'] = stripslashes($_POST["old-page-content"]);}

And let me know what happens? Smile
Reply
#94
Thanks for the quick response, but no luck, same problem remains.

hmm, clicking on the main-tab-button when active switches tab-content.
When saved only active-tab content is saved, also not including your seperation ||[tabname]||
<º)))><
Reply
#95
(2012-11-16, 22:19:02)uitdecom Wrote: hmm, clicking on the main-tab-button when active switches tab-content

Hmm... ok. In the same place you pasted that other code, can you delete the line and in its place put this:

Code:
print_r($_POST['old-page-content']); exit();

Which should put something on the page when save button is pressed. Then copy and paste into a reply the info that comes out.

Quote:Thanks for the quick response, but no luck, same problem remains.

No worries. Smile I'm glad I am able to help.
Reply
#96
changedata.php printed this:

{\"Main\":\"<p>\\n\\tmain tab content</p>\\n\"}

Huh
<º)))><
Reply
#97
(2012-11-16, 22:44:50)uitdecom Wrote: changedata.php printed this:

{\"Main\":\"<p>\\n\\tmain tab content</p>\\n\"}

Huh

I think that is a php setting called Magic Quotes. I'm surprised that code above didn't fix it though. Hmm...

If you swap that code just pasted with:

Code:
$_POST['old-page-content'] = stripslashes($_POST["old-page-content"]

That might work as a bandaid fix.

If you put this code in though, what do you get when you save page?

Code:
if (get_magic_quotes_gpc()){echo 'Magic Quotes is active.';}else{echo 'I\'m stumped! :P'; } exit();
Reply
#98
that didn't changed anything & 'Magic Quotes is active'

Problem seems to be before saving, because only the main tab is remembering the content (and the content /not the tab/ switches when main-tab-button is clicked) second tab just shows the same as what the main tab is showing.
<º)))><
Reply
#99
(2012-11-17, 00:23:24)uitdecom Wrote: that didn't changed anything & 'Magic Quotes is active'

Ok umm... I suppose another thing to check is this. Replace that code (again Tongue ) with this:

Code:
phpinfo(); exit();

Then from this (large) readout, look for a section named "json".
It'll tell you if json support is enabled. Which it should be, and needs to be.

You can also check the three "magic_quotes" options and see what is on and off.
Reply
magic_quotes_gpc is on, runtime and sybase are off, json (1.2.1) is enabled.
<º)))><
Reply




Users browsing this thread: 1 Guest(s)