PHPWord Table gridspan and Vmerge - php

I want to get that in phpword
------------------------
| | |
|-----------------------
| | |
------------------------
| | | | |
|-----------------------
but I keep getting
----------------------
| | |
|---------------------------------
| | | | |
----------------------------------
I am familiar with the fact that I have to somehow incorporate:
array('gridSpan' => 3) ($table->addCell(15000, array('gridSpan' => 3))->addText(htmlspecialchars('text'), $fontTitle);)
but I can't figure out the correct syntax to actually get the table to look the way I want it to work.

I figured it out,
you have to add
$cell5->getStyle()->setGridSpan(3);

Related

Sorting on data from language file

I want to have translations for a number of languages coming from the default Language files (as provided by CI). I'd also like to do some sorting on these values (e.g. to insert them in a dropdown list, I want them to be alphabetically sorted).
I have a project running in CodeIgniter and am in the process of moving all hardcoded text to the language files. This also includes some database tables.
For example, I have the following table:
+-------------+---------------------+--------------------+---------------+
| language_id | language_nl | language_en | language_code |
+-------------+---------------------+--------------------+---------------+
| 1 | Afrikaans | Afrikaans | AF |
| 2 | Albanese | Albanian | SQ |
| 3 | Arabisch | Arabic | AR |
| 4 | Armeens | Armenian | HY |
| 5 | baskisch | Basque | EU |
| 6 | Bengalees | Bengali | BN |
| | | | |
+-------------+---------------------+--------------------+---------------+
Now I would like to transfer this table to my language file.
I will first start by deleting the language_nl and language_en columns.
A new column will have to be introduced as well, language_key.
So it should look like this:
+-------------+--------------+---------------+
| language_id | language_key | language_code |
+-------------+--------------+---------------+
| 1 | language_af | AF |
| 2 | language_sq | SQ |
| 3 | language_ar | AR |
| 4 | language_hy | HY |
| 5 | language_eu | EU |
| 6 | language_bn | BN |
+-------------+--------------+---------------+
Then in my language file I will add the following lines:
$lang["language_af"] = "African";
$lang["language_sq"] = "Albanian";
$lang["language_ar"] = "Arabic";
And so on...
I will then create a manager class to help me in finding the translations for each necessary language for the key.
It would look something like this:
public function getLanguageName($key) {
return lang(key);
}
Now I have two main questions:
1) Is this a good way of approaching the issue I have?
2) Let's say I need the languages to be shown in a drop-down. I want this dropdown to be alphabetically sorted (order will be different based on the language selected, of course). How do I approach this issue? Do I load in all the values from the language file, put them in an array and then sort that array?

phpmyadmin prefixes a number to the existing numbers of certain columns in certain tables

Sorry for the difficult description, but I know of no better way to say it.
When I look in certain tables of a MySQL database through the phpMyAdmin web interface, the numbers of the first two columns are prefixed by a '3'.
So if the first column has number 99, phpMyAdmin displays 3939.
The second column has number 3592, phpMyAdmin shows 33353932.
If I check the records with the mysql CLI they are displayed correctly.
It only happens to some columns in some tables of some databases... not to all.
So it might be something with the tables themselves or something with phpMyAdmin.
System/version info:
Ubuntu 16.04.3 LTS
phpmyadmin 4:4.5.4.1-2ubuntu2
apache2 2.4.18-2ubuntu3.5
php7.0 7.0.22-0ubuntu0.16.04.1
oracle-java9 9.0.1-1~webupd8~0
mysql-server 5.7.20-0ubuntu0.16.04.1
I'm hoping someone has some idea of what might be happening here.
If you wish any further clarification please let me know.
mysql CLI:
+------------------------------+
| Tables_in_gsb |
+------------------------------+
| gsb_challenge |
| gsb_challenge_pos |
| gsb_challenge_scope |
| gsb_copyright |
| gsb_correction |
| gsb_correction_gold |
| gsb_correction_literality |
| gsb_correction_sentalign |
| gsb_correction_tag |
| gsb_correction_tokenization |
| gsb_correction_wordalign |
| gsb_doc_counts |
| gsb_doc_status |
| gsb_doc_warnings |
| gsb_documents |
| gsb_log |
| gsb_reports_verbnet |
| gsb_semlex_entry |
| gsb_semlex_entry_cooc_cat |
| gsb_semlex_entry_cooc_lemma |
| gsb_semlex_entry_cooc_ne |
| gsb_semlex_entry_cooc_pos |
| gsb_semlex_entry_cooc_roles |
| gsb_semlex_entry_name |
| gsb_semlex_occurrence |
| gsb_status_flag |
| gsb_subcorpus |
| gsb_synsets |
| gsb_user |
| gsb_userCake_Groups |
| gsb_userCake_Users |
| gsb_v_accepted_docs |
| gsb_v_last_doc_status |
| gsb_v_last_doc_update |
| pmb_annotation_status |
| pmb_correction |
| pmb_correction_sentalign |
| pmb_correction_tag |
| pmb_correction_tokenization |
| pmb_dmatch |
| pmb_doc_counts |
| pmb_doc_lists |
| pmb_doc_status |
| pmb_doc_warnings |
| pmb_documents |
| pmb_lrec |
| pmb_lrec_dmatch |
| pmb_lrec_dmatch_backup |
| pmb_lrec_promatch |
| pmb_promatch |
| pmb_promatch_copy |
| pmb_reports_verbnet |
| pmb_semlex_entry |
| pmb_semlex_entry_cooc_cat |
| pmb_semlex_entry_cooc_lemma |
| pmb_semlex_entry_cooc_pos |
| pmb_semlex_entry_cooc_roles |
| pmb_semlex_entry_cooc_semtag |
| pmb_semlex_occurrence |
| pmb_status_flag |
| pmb_subcorpus |
| pmb_synsets |
| pmb_synsets_new |
| pmb_userCake_Groups |
| pmb_userCake_Users |
| pmb_v_phrase_search |
+------------------------------+
SELECT * FROM pmb_semlex_occurrence ORDER BY part DESC LIMIT 10;
+------+--------+-------+------+------+--------+------+----------------+------+----+-----------+---------+-----------+--------+--------+--------+----------+----------------------------------+
| part | doc_id | tokid | from | to | toknum | snum | cat | pos | ne | roles | wordnet | wordsense | semtag | lemma | token | token_lc | entry_id |
+------+--------+-------+------+------+--------+------+----------------+------+----+-----------+---------+-----------+--------+--------+--------+----------+----------------------------------+
| 99 | 3592 | 15056 | 2202 | 2203 | 453 | 15 | (N/PP)\(N/PP) | LQU | | [] | O | O | NIL | " | " | " | 594f1919d740100ed2f3e4cfd4100329 |
| 99 | 3592 | 15055 | 2201 | 2202 | 452 | 15 | (N/PP)\(N/PP) | . | | [] | O | O | NIL | . | . | . | 594f1919d740100ed2f3e4cfd4100329 |
phpmyadmin:
It's not my database, I only maintain the server it's running on, so I don't think it's a prank... and how would they even do that?
With the additional information that these columns are of BINARY type I was able to find two bug reports describing this behaviour:
broken view of binary fields (every second three)
broken link to table of binary fields (every second three)
The first should have been resolved in phpMyAdmin 4.3, but I see that you're using version 4.5. The related second issue was reported against version 4.7.1 and fixed in version 4.7.3.
Try upgrading to phpMyAdmin 4.7.3 or later (at the time of writing the latest version is 4.7.7).

Strange URL Rewrite Issues in Magento

Im having a very bizarre problem with a magento store that I work on. I have been doing the SEO and have about 100 404 errors for product urls that SHOULD be valid.
I can see the products and the urls in the product catalog via the admin - everything is correct there. If I try to load the product by its url key using the product model I get the correct product back (a configurable product with id 12457 - this is important for later).
But if I try to load the page by the url path - it wont load - instead I get a 404 error - even with developer mode - I get no insight into the issue as there isnt really ANYTHING to follow in the system.log or in the Varien profiler / debugger except the normal noRouteAction stuff that comes up.
So I started investigating the core_url_rewrites table to see if I could identify multiple (duplicate) urls. Sure enough - I did. The core_url_rewrite table had over 30000 rows with 2.5x the # of products for the product group so I deleted the rows in the table and reindexed.
This gave me the proper count of products - and I can see that there is a duplicate url issue of some sort:
+----------------+----------+--------------------+-------------------------------------------------------------------------------------------------+---------------------------------------------+-----------+---------+-------------+-------------+------------+
| url_rewrite_id | store_id | id_path | request_path | target_path | is_system | options | description | category_id | product_id |
+----------------+----------+--------------------+-------------------------------------------------------------------------------------------------+---------------------------------------------+-----------+---------+-------------+-------------+------------+
| 200513 | 1 | product/12279 | torano-exodus-1959-50-years-bfc-cigars.html | catalog/product/view/id/12279 | 1 | NULL | NULL | NULL | 12279 |
| 200514 | 1 | product/12280 | torano-exodus-1959-50-years-bfc-single-cigar.html | catalog/product/view/id/12280 | 1 | NULL | NULL | NULL | 12280 |
| 200759 | 1 | product/12408 | torano-exodus-1959-50-years-bfc.html | catalog/product/view/id/12408 | 1 | NULL | NULL | NULL | 12408 |
| 200760 | 1 | product/12408/8 | all-brands/torano-exodus-1959-50-years-bfc.html | catalog/product/view/id/12408/category/8 | 1 | NULL | NULL | 8 | 12408 |
| 200761 | 1 | product/12408/3535 | all-brands/torano-cigars/torano-exodus-1959-50-years/torano-exodus-1959-50-years-bfc.html | catalog/product/view/id/12408/category/3535 | 1 | NULL | NULL | 3535 | 12408 |
| 200762 | 1 | product/12408/3708 | all-brands/torano-cigars/torano-exodus-1959-50-years-bfc.html | catalog/product/view/id/12408/category/3708 | 1 | NULL | NULL | 3708 | 12408 |
| 200901 | 1 | product/12457 | torano-exodus-1959-50-years-bfc-12457.html | catalog/product/view/id/12457 | 1 | NULL | NULL | NULL | 12457 |
| 200902 | 1 | product/12457/3535 | all-brands/torano-cigars/torano-exodus-1959-50-years/torano-exodus-1959-50-years-bfc-12457.html | catalog/product/view/id/12457/category/3535 | 1 | NULL | NULL | 3535 | 12457 |
| 200903 | 1 | product/12457/3708 | all-brands/torano-cigars/torano-exodus-1959-50-years-bfc-12457.html | catalog/product/view/id/12457/category/3708 | 1 | NULL | NULL | 3708 | 12457 |
+----------------+----------+--------------------+-------------------------------------------------------------------------------------------------+---------------------------------------------+-----------+---------+-------------+-------------+------------+
It appears that product #12408 is taking the URL that belongs to 12457 - so logically I went to find product # 12408 to correct the issue - however - after searching the admin - as well as just querying the database there ISN'T an entity_id 12408 in catalog_product_flat_x that I can find.
This is obviously a problem - and at this point I dont know where to go looking for 12408 to either correct it or remove it so it stops breaking 12457's url.
Can anyone out there tell me how to fix this?
Thanks in Advance!

Remove HTTP methods in Laravel routes

I'm using Laravel Resource routing (through a controller). Here is the routing code
Route::resource( 'difficulty', 'DifficultyController', [ 'only' => [ 'index', 'show', 'update', 'create' ] ] );
Here are the routes created
+--------+----------+-------------------------+-------------------+--------------------------------------------------+------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+----------+-------------------------+-------------------+--------------------------------------------------+------------+
| | GET|HEAD | difficulty | difficulty.index | App\Http\Controllers\DifficultyController#index | |
| | GET|HEAD | difficulty/create | difficulty.create | App\Http\Controllers\DifficultyController#create | |
| | PATCH | difficulty/{difficulty} | | App\Http\Controllers\DifficultyController#update | |
| | GET|HEAD | difficulty/{difficulty} | difficulty.show | App\Http\Controllers\DifficultyController#show | |
| | PUT | difficulty/{difficulty} | difficulty.update | App\Http\Controllers\DifficultyController#update | |
+--------+----------+-------------------------+-------------------+--------------------------------------------------+------------+
It works fine, except that I don't need the "HEAD" and "PATCH" methods and I want to remove them. So listing routes will display the following
+--------+----------+-------------------------+-------------------+--------------------------------------------------+------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+----------+-------------------------+-------------------+--------------------------------------------------+------------+
| | GET | difficulty | difficulty.index | App\Http\Controllers\DifficultyController#index | |
| | GET | difficulty/create | difficulty.create | App\Http\Controllers\DifficultyController#create | |
| | GET | difficulty/{difficulty} | difficulty.show | App\Http\Controllers\DifficultyController#show | |
| | PUT | difficulty/{difficulty} | difficulty.update | App\Http\Controllers\DifficultyController#update | |
+--------+----------+-------------------------+-------------------+--------------------------------------------------+------------+
Is it possible to do it? I'm using Laravel 5.1
What about just doing explicit declarations?
Route::get('/difficulty','DifficultyController#index');
Route::get('/difficulty/create','DifficultyController#create');
Route::get('/difficulty/{difficulty}','DifficultyController#show');
Route::put('/difficulty/{difficulty}','DifficultyController#update');
I even prefer having it this way since it gives a clearer picture of what your application does.

sub-domain routing in laravel

I have just put a practice laravel app on my development server at app.mydomain.co
I have looked at the docs and I wrapped the routes with the sub domain group like so
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::group(array('domain' => 'app.mydomain.co'), function()
{
Route::get('/', array('as'=>'home', 'uses'=>'QuestionController#getIndex'));
//Route::get('create', array('as'=>'create', 'uses'=>'UserController#getCreate'));
//Route::get('login', array('as'=>'login', 'uses'=>'UserController#getLogin'));
/*
Define RESTful Controllers
*/
Route::controller('user', 'UserController');
Route::controller('questions', 'QuestionController');
});
The home page works fine but the rest of the routes are 404 not found errors so obviously I am doing something wrong, any ideas?
here is the output for php artisan routes with the domain substituted with app
+--------------+--------------------------------------------------------+------+-------------------------------------+----------------+---------------+
| Domain | URI | Name | Action | Before Filters | After Filters |
+--------------+--------------------------------------------------------+------+-------------------------------------+----------------+---------------+
| qapp.app.co | GET /user/index/{v1}/{v2}/{v3}/{v4}/{v5} | | UserController#getIndex | | |
| qapp.app.co | GET /user | | UserController#getIndex | | |
| qapp.app.co | GET /user/create/{v1}/{v2}/{v3}/{v4}/{v5} | | UserController#getCreate | | |
| qapp.app.co | POST /user/store/{v1}/{v2}/{v3}/{v4}/{v5} | | UserController#postStore | | |
| qapp.app.co | GET /user/login/{v1}/{v2}/{v3}/{v4}/{v5} | | UserController#getLogin | | |
| qapp.app.co | POST /user/login/{v1}/{v2}/{v3}/{v4}/{v5} | | UserController#postLogin | | |
| qapp.app.co | GET /user/logout/{v1}/{v2}/{v3}/{v4}/{v5} | | UserController#getLogout | | |
| qapp.app.co | GET /user/{_missing} | | UserController#missingMethod | | |
| qapp.app.co | GET /questions/index/{v1}/{v2}/{v3}/{v4}/{v5} | | QuestionController#getIndex | | |
| qapp.app.co | GET /questions | | QuestionController#getIndex | | |
| qapp.app.co | POST /questions/store/{v1}/{v2}/{v3}/{v4}/{v5} | | QuestionController#postStore | | |
| qapp.app.co | GET /questions/show/{v1}/{v2}/{v3}/{v4}/{v5} | | QuestionController#getShow | | |
| qapp.app.co | GET /questions/edit/{v1}/{v2}/{v3}/{v4}/{v5} | | QuestionController#getEdit | | |
| qapp.app.co | PUT /questions/update/{v1}/{v2}/{v3}/{v4}/{v5} | | QuestionController#putUpdate | | |
| qapp.app.co | GET /questions/your-questions/{v1}/{v2}/{v3}/{v4}/{v5} | | QuestionController#getYourQuestions | | |
| qapp.app.co | GET /questions/{_missing} | | QuestionController#missingMethod | | |
| | GET / | home | QuestionController#getIndex
When I look at the apache error log it appears to be looking in the laravel public folder for a file or directory related to the php query so if I am trying to access the questions controller method show with url qapp.app.co/questions/show/14 the error is file does not exist: /var/www/app/public/questions
I was able to solve my problem by setting AllowOverride to All in the virtual host. Maybe it will work for you too? See http://laracasts.com/forum/351-how-do-you-install-laravel-into-a-subdomain
The home page works fine but the rest of the routes are not found errors so obviously I am doing something wrong
This would already give you a hint what's actually wrong with your config. The route would prioritize from top to bottom, so technically you should define '/' route at the bottom (and not the top.

Categories