phpmyadmin - default to structure instead of browse - php

Can I set the default in phpMyAdmin to open in structure instead of browse?
thanks

If perchance you are using the "quick access icon" next to the table name in the navigation frame, this may be configured.
From the configuration file documentation:
$cfg['LeftDefaultTabTable'] string
Defines the tab displayed by default when clicking the small icon
next to each table name in the
navigation panel. Possible values:
"tbl_structure.php", "tbl_sql.php",
"tbl_select.php", "tbl_change.php" or
"sql.php".
For MAMP 3.x the DefaultTabTable configuration parameter applies. It needs to be set in MAMP/bin/phpMyAdmin/config.inc.php, e.g.:
$cfg['DefaultTabTable'] = 'sql.php';

As I said in my comment, you can click on the little table icon to the left of the table name (assuming, as Mike B said, we are talking about the table list on the left) and it will open up the table structure page.
AFAIK, switching the behavior on those links is not possible through a configuration directive. You would have to dig through the code and change it in there. Shouldn't be too complicated, though.

Add:
$cfg['DefaultTabTable'] = 'tbl_structure.php';
To either config.inc.php or config.default.php.
You can also change LeftDefaultTabTable which changes the icon. The options are:
'tbl_structure.php' = fields list
'tbl_sql.php' = SQL form
'tbl_select.php' = search page
'tbl_change.php' = insert row page
'sql.php' = browse page

In phpMyAdmin 4.8.2...
Click the double gears icon at the top of the left navigation pane.
Then click the "Tables" tab within the popup modal. (last tab)
There you can set the "Target for quick access icon" setting, which is referring to the little index card icon to the left of the table links in the left pane.
I didn't see any settings to change the default link behavior, but you can also add an additional "Target for second quick access icon" and define it's default view behavior differently if desired. It adds an additional "Quick access" icon to the left of the table links with your chosen behavior.

I use an old version of XAMPP (1.6.7) which contains an old version of phpMyAdmin (2.11.7), but the following worked for me.
In the /phpmyadmin/libraries/config.default.php file there is a section of code that handles how the table is viewed.
Change the last two lines of code to suit your purposes, for mine I wanted to open tables in "Browse" view, not "Structure" view (which was my default).
/**
* Possible values:
* 'tbl_structure.php' = fields list
* 'tbl_sql.php' = SQL form
* 'tbl_select.php' = select page
* 'tbl_change.php' = insert row page
* 'sql.php' = browse page
*
* #global string $cfg['DefaultTabTable']
*/
// Show table Structure - Default
$cfg['DefaultTabTable'] = 'tbl_structure.php';
// Uncomment below to show table data
// $cfg['DefaultTabTable'] = 'sql.php';
Save this config file and refresh PhpMyAdmin in your browser.
Hope that helps!

In version 3.5.1: go to the PhpMyAdmin home page -> Settings -> Navigation Frame -> Tables tab. Here you will find an option "Target for quick access icon", and set it
"sql.php" if you want it to go to the Browse tab
"tbl_structure.php" if you want it to go to the Structure tab
"tbl_sql.php" if you want it to go to the SQL tab
"tbl_select.php" if you want it to go to the Search tab
"tbl_change.php" if you want it to go to the Insert tab.
Then Save.
This way when you will click on the table name, it will go to the structure; and when clicking on the little icon before the table name, it will go to the tab you just set.

navigation.php
Around Line #646 in phpMyAdmin version 3.3.8
Insert
$href = $GLOBALS['cfg']['LeftDefaultTabTable'] . '?'
. $GLOBALS['common_url_query']
.'&table=' . urlencode($table['Name'])
.'&goto=' . $GLOBALS['cfg']['LeftDefaultTabTable'];
AFTER
$href = $GLOBALS['cfg']['DefaultTabTable'] . '?'
.$GLOBALS['common_url_query'] . '&table='
.urlencode($table['Name']) . '&pos=0';
to make the text field name link in the navigation to behave the same as the little icon to the left of it.

In my version, the configuration setting for it is supposed to be
$cfg['DefaultTabTable'] = 'tbl_structure.php';
It is listed in sample config file. However, /libraries/navigation/Nodes/Node_Table.class.php on line 34 ignores this setting and uses 'sql.php' directly. I changed that line to
'text' => $GLOBALS['cfg']['DefaultTabTable'].'?server=' . $GLOBALS['server']
On that line and it works fine for me.

Go to phpMyAdmin/config.inc.php
find line starting
$cfg['DefaultTabTable']
and set it to value
$cfg['DefaultTabTable'] = 'browse';
Restart Apache, empty session data (second icon under phpMyAdmin logo, alternatively log-out and log-in, not sure if this step is needed, some configs are cached in user's session)
This solved the issue in MAMP 5.7 (i.e. if you click on table name in left navigation tree, the Browse tab is open). PhpMyAdmin is located in MAMP/bin folder

I was following the instructions from etheros and wasn't able to find that configuration option, but it can just be added (to the confic.inc.php file). In my config file, I added it to the "Left frame setup" section, around line 160.

Depending on the phpMyAdmin version either of these should work:
$cfg['LeftDefaultTabTable'] = 'tbl_structure.php';
$cfg['NavigationTreeDefaultTabTable'] = 'tbl_structure.php';
Also you may actually be saving these setting in the phpmyadmin database, table=pma__userconfig. Go ot the phpmyadmin home and click Settings -> Navigation Frame ->Tables -> Target for quick access icon

Related

Cannot access Categories in dashboard (Magento)

So i have installed couple of extensions one of them was fontis feed generator, everything is working fine till i try and access Manage Categories the it comes up with "There has been an error processing your request"
The error is as follows
a:5:{i:0;s:110:"Source model "feedsgenerator/googleproducts_source_taxonomy" not found for attribute "google_product_category"";i:1;s:4101:"#0
Run this sql code to check if there's the attribute causing issues:
select * from eav_attribute where attribute_code = "google_product_category";
If you'll get a result showing the attribute then you should remove it. To do this you can do the following:
Add this to the end of your index.php file:
$installer = Mage::getResourceModel('catalog/setup','catalog_setup');
$installer->removeAttribute('catalog_category','google_product_category');
Run the website once with disabled cache (make sure the code run) and then remove the two lines from index.php.
This should be fixed now. You can check if the attribute still exists by running the sql code again:
select * from eav_attribute where attribute_code = "google_product_category";

Force Joomla JRoute to use the menu item

I'm building a component for Joomla! 2.5 and inside I'm using JRoute::_('index.php?option=com_myapp&view=cpanel') to build all my links. This works, BUT it produces links which look like that:
/component/myapp/cpanel.html
In the menu however I have defined that index.php?option=com_myapp&view=cpanel has an alias of "myapp" so the link should rather be
/myapp/cpanel.html
The component is accessible via this path. If I do that, also all links generated inside will have the /myapp prefix. But for use in a template (special login link) and if the user stumbles upon /component/myapp.... I still want all links to go to /myapp prefix.
How can I force JRoute to use this menu item entry by itself?
Because I struggled a lot with this issue, here's a quick function I did that will try to find the link based on a menu item. It's mainly based on other answers.
This has only been tested on Joomla 3.5. JRequest is deprecated, so $app->input is used instead. This might be done better, but at least it works for the use I have of it. Hopes it can help other people too !
public static function getRouteMenu($default_url) {
$db = JFactory::getDbo();
$app = JFactory::getApplication();
$jinput = $app->input;
$db->setQuery('SELECT `id` FROM #__menu WHERE `link` LIKE '. $db->Quote($default_url) .' AND `published` = 1 LIMIT 1' );
$itemId = $db->loadResult();
if($itemId) {
$route = $jinput->getString('return', JRoute::_('index.php?Itemid='.$itemId));
$route = str_replace('index.php/', '', $route);
} else {
$route = $jinput->getString('return', JRoute::_($default_url));
}
return $route;
}
The parameter requires a not rewrited link such as : index.php?option=com_content&view=article&id=10. Check your database if you need to be sure about how to build up this link.
//look if there is a menu item set for myapp. if yes, we use that one to redirect
$db = JFactory::getDBO();
$defaultRedirect = 'index.php?option=com_myapp&view=cpanel';
$db->setQuery('SELECT `id` FROM #__menu WHERE `link` LIKE '. $db->Quote($defaultRedirect) .' LIMIT 1' );
$itemId = ($db->getErrorNum())? 0 : intval($db->loadResult());
if($itemId){
$rpath = JRequest::getString('return', base64_encode(JRoute::_('index.php?Itemid='.$itemId)));
}else{
$rpath = JRequest::getString('return', base64_encode(JRoute::_('index.php?option=com_myapp&view=cpanel')));
}
Beware: This is NOT language-safe. It takes the first menu entry found in the db. If you setup different menu aliases for different languages you have to check for the right language in the SQL query, too.
You ideally need to set a router as part of your component. The menu manager will override the component/myapp bit, but what comes after that will be determined by what is in the router.php file.
http://docs.joomla.org/Supporting_SEF_URLs_in_your_component
If, however, you simply need to create a link to a specific menu item, then you can always just add an Itemid to your parameter
JRoute::_('index.php?Itemid=12')
will point to any menu item with the id 12, so if that is your menu item ID for your com_myapp component, it will create the menu version of the link to that page.
edit:
You could technically assign the same component to two menu items, so I don't believe that handling the beginning of the URL is default behaviour when you link to a component outside of a menu item without giving the link an itemid. Joomla say (on creating a link for JRoute)...
"Notice that it is possible to leave out the parameters option and
Itemid. option defaults to the name of the component currently being
executed, and Itemid defaults to the current menu item's ID."
ie, call it from your homepage (or any page outside of one set to use your component) without an itemid or option and it is likely to think you are in com_content and with the homepage menu item.
If you want to link to the component outside of a menu item but without hard-coding an itemid, then one way would be to add a Menuitem field type to the config options of the module or template where you are linking from, and then add the itemid it generates to your link.
You could also use JFactory::getApplication()->getMenu() to find which menu item is linking to your component. Not had chance to test this - but using that could also mean that you can set an itemid parameter in your router.

Setting Wordpress base URL when moving to virtual domain for localhost?

I had a project on localhost, now in wamp I setted virtual domain. Now the local project opens fine on domain address but resource files on pages are not loading. In source code of pages css and js files are still linked with 'localhost' hence are not found.
Its very simple
Edit wp-config.php
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
Edit functions.php
and add the line
<?php
update_option('siteurl','http://example.com');
update_option('home','http://example.com');
?>
Take care of permalinks .htacess file & database resources links
You can check here
In your wp-config.php, add these two lines.
define('WP_HOME','sitename/');
define('WP_SITEURL','sitename/');
Also, you need to edit the SQL file to change the resource locations.
I wrote this tutorial which shows you how to do that.
It's here, on my blog.
If you want to maintain your ability to upgrade WordPress in one click, never edit the WordPress core code. Instead, you can use their recommended (clean "drop-in") solution:
Create a new file at /wp-content/db.php with this content:
<?php
/**
* #see http://codex.wordpress.org/Running_a_Development_Copy_of_WordPress
*/
add_filter('pre_option_home', 'test_localhosts');
add_filter('pre_option_siteurl', 'test_localhosts');
function test_localhosts()
{
if (isDevEnvironment($_SERVER)) {
return "http://mysite.local/blog"; //Specify your local dev URL here.
} else {
return false; // act as normal; will pull main site info from db
}
}
/**
* Logic to determine the environment (dev or prod)
* #return bool
*/
function isDevEnvironment($serverArray)
{
return strpos($serverArray['SERVER_NAME'], 'mysite.local') !== false;//Edit this function such that it returns a boolean based on your specific URL naming convention.
}
Now, your local development environment will use its own base URL, and then when you deploy a copy of your codebase to a production environment, it will use its production base URL automatically.
Try this:
You need to change your local links to live links.
For that, Update your database with some query.
:: Queries to change URL for WP Website
UPDATE pvgc_options
SET option_value = replace(option_value, 'http://pleasantviewgarden.hideoutdev.co.uk/',
'http://pleasantviewgardencentre.com/')
WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE pvgc_postmeta
SET meta_value = replace(meta_value, "http://whynickoli.com/", "http://localhost/onestopproperty/");
UPDATE pvgc_posts
SET guid = REPLACE(guid, "http://whynickoli.com/", "http://sparsh-technologies.co.in/megha/onestopproperty/");
UPDATE pvgc_posts
SET post_content = REPLACE(post_content, "http://whynickoli.com/",
"http://sparsh-technologies.co.in/megha/onestopproperty/");
Here you should use your domain.
Thanks!
Edit the wp-config.php settings for a new domain:
define('WP_HOME','siteurl');
define('WP_SITEURL','siteurl');
Search and replace on the database with InterconnectIT Search and Replace Tool. With that tool it's easy to search through the entire database for all occurrences of old domain, and replace that with the name of new domain

Typo3 +TV not rendering content elements

I have installed typo3, templavoila and mapped a template.
Everything works fine, except my content elements. They just don't appear. They did before I installed templavoila and mapped a template.
Also, when using
10 = RECORDS
10 {
tables = tt_content
source = 9
}
it does not give me any output.
even nothing with:
10 = RECORDS
10 {
tables = tt_content
source = 9
conf.tt_content = TEXT
conf.tt_content.value = TEST
}
Does anyone have a clue as to what I might be doing wrong?
You must include the css styled content static template in your TS template.
In your ts page object you need to assign it to the templavoila object.
# Default PAGE object:
page = PAGE
page.typeNum = 0
page.10 = USER
page.10.userFunc = tx_templavoila_pi1->main_page
Probably the page, where tt_content is situated is not visible to regular visitor ?
In this case, following snippet will help.
10 = RECORDS
10.tables = tt_content
10.source = 9
10.dontCheckPid = 1
Finally we got it to work. Don't know what I did wrong, but I guess I learned not to do it again.
I'll put the "solution" here since someone might find it helpful and lose more than a day over this like I did.
Solution:
copy an existing content element in list mode, pasted it on a page via page mode
This was to test if that would do anything. Guess what, everything worked again. Not only the newly copied element but also ALL other test elements created via different ways on different pages and storage folders.
Thank you all for helping and thinking along.

WordPress deactivate a plugin via database?

I have a wordpress script, wp-supercache, that I need to disable (as its cached on a nasty error), however, the error is causing the wp-admin redirect to fail, which means I can't get into the site to disable the plugin.
Any advice? I can access the database via cpanel.
Try re-naming the folder of the plugin and then see if error is gone (make backup first of course.). If that does not help, here is the solution then.
To disable a specific plugin, you have to remove it from the serialized string that stores the list of all plugins - that's set in the option_value column of the wp_options table as discussed by #TimDurden. The specific format change you have to make is, taken shamelessly from teh Internet:
a:4:{
i:0;s:19:"akismet/akismet.php";
i:1;s:36:"google-sitemap-generator/sitemap.php";
i:2;s:55:"google-syntax-highlighter/google_syntax_highlighter.php";
i:3;s:29:"wp-swfobject/wp-swfobject.php";
}
That first set of characters - a:4 - designates an array and its length. Note also that each line in the list of plugins has an index. So:
Decrement the index (from 4 to 3 in this case)
In each line, decrement the number after the i:
Remove the specific plugin you want to disable.
Update the value in the db using the new string you constructed from these steps:
update wp_options set option_value=<new value> where option_id=<id of this option>
Note that your table name might not be wp_options - you might have a prefix to add.
You only need to rename the folder in /wp-content/plugins/ and the plugin will be automatically de-activated. Once it is de-activated, you will be able to login.
Backup database or just the wp_options table
SELECT option_value FROM wp_options WHERE option_name = 'active_plugins';
Copy selected string (serialized string) and paste in the left side at https://serializededitor.com/
Remove the line which plugin you want to deactivate
Copy the serialized result string from the right side and update active_plugins value with it.
UPDATE wp_options
SET option_value = 'THE_NEW_SERIALIZED_STRING'
WHERE option_name = 'active_plugins' LIMIT 1;
I wrote a little exe in .dot to repair/remove options string from database.
Download exe here
Run on MySQL server
SELECT * FROM wp_options WHERE option_name = 'active_plugins';
Paste Results in textbox, press parse.
Remove the ones you don't want.
Click output, it copies output to clipboard
replace brackets inside the single quotes below with output and Run on MySQL server
UPDATE wp_options SET option_value = '[replace inside single quotes with your output' WHERE option_name = 'active_plugins';
No warranties... I don't claim to be programmer
To disable all Wordpress plugins on your site:
Login to your database management tool (e.g. PHPMyAdmin)
Execute the following query:
UPDATE wp_options SET option_value = '' WHERE option_name = 'active_plugins';
Another way to do this is you can backup the site and then just rename the folder of the plugin under /wp-content/plugins/ to some other name . So the plugin will be disabled.
I wont prefer deleting the plugin folder as it may cause errors.
After the step is done log in to your wordpress site and delete the plugin from there
You just need to change the values in the record "active_plugins" in the database. You can find the process Here
Late answer,but answering as it will be useful to someone in the future. All the plugins are stored in the wp_options table in a serialized manner. U can edit this field manually. Or if you unserialize it using a function like in php using unserialize(), you will get an array. just modify it to remove the plugin you want to remove from that array, and serialize it back. then update the table. Thats it. If you want to know more about it here is a good article. It explains all about this.
Using this code you can activate your plugin from the functions.php:
function activate_plugin_via_php() {
$active_plugins = get_option( 'active_plugins' );
array_push($active_plugins, 'unyson/unyson.php'); /* Here just replace unyson plugin directory and plugin file*/
update_option( 'active_plugins', $active_plugins );
}
add_action( 'init', 'activate_plugin_via_php' );

Categories