In 1898, Zhang published his work, Exhortation to Study (勸學篇). He insisted on a method of relatively conservative reform, summarized in his phrase "Chinese learning for fundamental principles and Western learning for practical application" (中學為體,西學為用). In 1900, he advocated the suppression of the Boxer Rebellion. When the Eight-Nation Alliance entered Beijing, Zhang, along with Li Hongzhang and others, participated in The Mutual Protection of Southeast China. He quelled local revolts and defeated the rebel army of Tang Caichang. He succeeded Liu Kunyi as Viceroy of Liangjiang in 1901, and moved to Nanjing, where he laid the foundations for the modern University of Nanjing. He was appointed the Minister of Military Affairs in 1906, and worked in Beijing for the central government.